Part Number Hot Search : 
D2010 11201 FQS4410 RP23256 2SK27 STPS1L60 8051F121 812D240
Product Description
Full Text Search
 

To Download HD64F3643 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  to our customers, old company name in catalogs and other documents on april 1 st , 2010, nec electronics corporation merged with renesas technology corporation, and renesas electronics corporation took over all the business of both companies. therefore, although the old company name remains in this document, it is a valid renesas electronics document. we appreciate your understanding. renesas electronics website: http://www.renesas.com april 1 st , 2010 renesas electronics corporation issued by: renesas electronics corporation ( http://www.renesas.com ) send any inquiries to http://www.renesas.com/inquiry .
notice 1. all information included in this document is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas electronics products listed herein, please confirm the latest product information with a renesas electronics sales office. also, please pay regular and careful attention to additional and different information to be disclosed by renesas electronics such as that disclosed through our website. 2. renesas electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property ri ghts of third parties by or arising from the use of renesas electronics products or technical information described in this document . no license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property right s of renesas electronics or others. 3. you should not alter, modify, copy, or otherwise misappropriate any renesas electronics product, whether in whole or in part . 4. descriptions of circuits, software and other related information in this document are provided only to illustrate the operat ion of semiconductor products and application examples. you are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. renesas electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information. 5. when exporting the products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations. you should not use renesas electronics products or the technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. renesas electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. 6. renesas electronics has used reasonable care in preparing the information included in this document, but renesas electronics does not warrant that such information is error free. renesas electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. 7. renesas electronics products are classified according to the following three quality grades: ?standard?, ?high quality?, an d ?specific?. the recommended applications for each renesas electronics product depends on the product?s quality grade, as indicated below. you must check the quality grade of each renesas electronics product before using it in a particular application. you may not use any renesas electronics product for any application categorized as ?specific? without the prior written consent of renesas electronics. further, you may not use any renesas electronics product for any application for which it is not intended without the prior written consent of renesas electronics. renesas electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any renesas electronics product for a n application categorized as ?specific? or for which the product is not intended where you have failed to obtain the prior writte n consent of renesas electronics. the quality grade of each renesas electronics product is ?standard? unless otherwise expressly specified in a renesas electronics data sheets or data books, etc. ?standard?: computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots. ?high quality?: transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; an ti- crime systems; safety equipment; and medical equipment not specifically designed for life support. ?specific?: aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life. 8. you should use the renesas electronics products described in this document within the range specified by renesas electronics , especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas electronics shall have no liability for malfunctions o r damages arising out of the use of renesas electronics products beyond such specified ranges. 9. although renesas electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. fur ther, renesas electronics products are not subject to radiation resistance design. please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 10. please contact a renesas electronics sales office for details as to environmental matters such as the environmental compatibility of each renesas electronics product. please use renesas electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the eu rohs directive. renesas electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. 11. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of renes as electronics. 12. please contact a renesas electronics sales office if you have any questions regarding the information contained in this document or renesas electronics products, or if you have any other inquiries. (note 1) ?renesas electronics? as used in this document means renesas electronics corporation and also includes its majority- owned subsidiaries. (note 2) ?renesas electronics product(s)? means any product developed or manufactured by or for renesas electronics.
h8/3644 group, h8/3644r group h8/3644 f-ztat tm , h8/3643 f-ztat tm , h8/3642a f-ztat tm hardware manual 8 users manual rev.6.00 2006.09 renesas 8-bit single-chip microcomputer h8 family/h8/300l series h8/3644 hd6473644 h8/3644r hd6473644r hd6433644 hd6433644r hd64f3644 h8/3643 hd6433643 h8/3643r hd6433643r HD64F3643 h8/3642 hd6433642 h8/3642r hd6433642r hd64f3642a h8/3641 hd6433641 h8/3641r hd6433641r h8/3640 hd6433640 h8/3640r hd6433640r
rev. 6.00 sep 12, 2006 page ii of xx 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corp. product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corp. or a third party. 2. renesas technology corp. assumes no responsibility for any damage, or infringement of any third- party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corp. without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corp. or an authorized renesas technology corp. product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corp. assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corp. by various means, including the renesas technology corp. semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corp. assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology corp. semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corp. or an authorized renesas technology corp. product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corp. is necessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. 8. please contact renesas technology corp. for further details on these materials or the products contained therein. 1. renesas technology corp. puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. keep safety first in your circuit designs! notes regarding these materials
rev. 6.00 sep 12, 2006 page iii of xx general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are used as test pins or to reduce noise. if something is connected to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the product?s state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pin. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresses. do not access these registers; the system?s operation is not guaranteed if they are accessed.
rev. 6.00 sep 12, 2006 page iv of xx
rev. 6.00 sep 12, 2006 page v of xx preface the h8/300l series of single-chip microcomputers has the high-speed h8/300l cpu at its core, with many necessary peripheral functions on-chip. the h8/300l cpu instruction set is compatible with the h8/300 cpu. the h8/3644 group has a system-on-a-chip architecture that includes such peripheral functions as a d/a converter, five timers, a 14-bit pwm, a two-channel serial communication interface, and an a/d converter. this makes it ideal for use in advanced control systems. this manual describes the hardware of the h8/3644 group. for details on the h8/3644 group instruction set, refer to the h8/300l series programming manual.
rev. 6.00 sep 12, 2006 page vi of xx
rev. 6.00 sep 12, 2006 page vii of xx main revisions in this edition item page revision (see manual for details) all ? ? notification of change in company name amended (before) hitachi, ltd. (after) renesas technology corp. ? product naming convention amended (before) h8/3644 series (after) h8/3644 group (before) h8/3644r series (after) h8/3644r group 3.3.2 interrupt control registers interrupt edge select register 2 (iegr2) 64 description amended iegr2 is an 8-bit read/write register, used to designate whether pins int 7 to int 0 , and tmib are set to rising edge sensing or falling edge sensing. upon reset, iegr2 is initialized to h'00. bit 7 ? int 7 edge select (integ7): bit 7 selects the input sensing of the int 7 pin. bit 7: integ7 description 0 falling edge of int 7 pin input is detected (initial value) 1 rising edge of int 7 pin input is detected 6.2.2 memory map table 6.2 socket adapter figure 6.2 socket adapter pin correspondence (ztat) 102, 103 description of socket adapter deleted 6.8.2 memory map table 6.14 socket adapter product codes figure 6.19 socket adapter pin correspondence (f-ztat) 149, 151 description of socket adapter deleted 6.9 flash memory programming and erasing precautions table 6.18 flash memory ac characteristics 165 table amended item symbol min typ max unit test conditions flash memory read setup time * 4 t frs 50 ?? ?? 8.4.2 register configuration and description port mode register 7 (pmr7) 182 bit table amended bit 76543210 ????? ?
rev. 6.00 sep 12, 2006 page viii of xx item page revision (see manual for details) 10.2.2 register descriptions serial control/status register 1 (scsr1) 281 description amended scsr1 is an 8-bit register indicating operation status and error status. 10.3.1 overview figure 10.6 sci3 block diagram 291 figure amended clock txd rxd sck 3 brr smr scr3 ssr tdr rdr tsr rsr transmit/receive control circuit internal data bus interrupt request (tei, txi, rxi, eri) internal clock ( 10.3.7 interrupts table 10.16 sci3 interrupt requests 336 table amended vector address h'002a
rev. 6.00 sep 12, 2006 page ix of xx item page revision (see manual for details) 13.2.4 dc characteristics (hd6433644, hd6433643, hd6433642, hd6433641, hd6433640) table 13.6 dc characteristics 374 table amended values item symbol applicable pins min typ max unit test condition notes active mode current dissipation i ope1 v cc ? ? ? ? ? ? ? ? ? ? ? ? 13.2.5 ac characteristics (hd6433644, hd6433643, hd6433642, hd6433641, hd6433640) table 13.9 serial interface (sci3) timing 380 table amended v cc = 2.5 v to 5.5 v, av cc = 2.7 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. 13.3.5 ac characteristics (hd6433644r, hd6433643r, hd6433642r, hd6433641r, hd6433640r) table 13.18 serial interface (sci3) timing 404 table amended v cc = 2.5 v to 5.5 v, av cc = 2.7 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified.
rev. 6.00 sep 12, 2006 page x of xx item page revision (see manual for details) a.1 instructions table a.1 instruction set 427 table amended mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @?rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code ? ? ? ? ? ? ? b.2 functions iegr2?interrupt edge select register 2 485 bit table amended int 7 edge select 0 falling edge of int 7 pin input is detected rising edge of int 7 pin input is detected 1
rev. 6.00 sep 12, 2006 page xi of xx contents section 1 overview ............................................................................................................. 1 1.1 overview................................................................................................................... ........ 1 1.2 internal block diagram..................................................................................................... 6 1.3 pin arrangement and functions ........................................................................................ 7 1.3.1 pin arrangement .................................................................................................. 7 1.3.2 pin functions ....................................................................................................... 10 section 2 cpu ...................................................................................................................... 15 2.1 overview................................................................................................................... ........ 15 2.1.1 features................................................................................................................ 15 2.1.2 address space...................................................................................................... 16 2.1.3 register configuration ......................................................................................... 16 2.2 register descriptions ...................................................................................................... .. 18 2.2.1 general registers ................................................................................................. 18 2.2.2 control registers.................................................................................................. 18 2.2.3 initial register values.......................................................................................... 20 2.3 data formats ............................................................................................................... ...... 20 2.3.1 data formats in general registers....................................................................... 21 2.3.2 memory data formats ......................................................................................... 22 2.4 addressing modes........................................................................................................... .. 23 2.4.1 addressing modes................................................................................................ 23 2.4.2 effective address calculation.............................................................................. 25 2.5 instruction set ............................................................................................................ ....... 29 2.5.1 data transfer instructions.................................................................................... 31 2.5.2 arithmetic operations.......................................................................................... 33 2.5.3 logic operations.................................................................................................. 34 2.5.4 shift operations ................................................................................................... 34 2.5.5 bit manipulations................................................................................................. 36 2.5.6 branching instructions ......................................................................................... 40 2.5.7 system control instructions ................................................................................. 42 2.5.8 block data transfer instruction........................................................................... 43 2.6 basic operational timing ................................................................................................. 4 4 2.6.1 access to on-chip memory (ram, rom) ......................................................... 44 2.6.2 access to on-chip peripheral modules ............................................................... 45 2.7 cpu states ................................................................................................................. ....... 46 2.7.1 overview.............................................................................................................. 46 2.7.2 program execution state...................................................................................... 48 2.7.3 program halt state ............................................................................................... 48
rev. 6.00 sep 12, 2006 page xii of xx 2.7.4 exception-handling state .................................................................................... 48 2.8 memory map................................................................................................................. .... 49 2.9 application notes .......................................................................................................... ... 50 2.9.1 notes on data access .......................................................................................... 50 2.9.2 notes on bit manipulation................................................................................... 52 2.9.3 notes on use of the eepmov instruction .......................................................... 58 section 3 exception handling ......................................................................................... 59 3.1 overview................................................................................................................... ........ 59 3.2 reset 59 3.2.1 overview.............................................................................................................. 59 3.2.2 reset sequence .................................................................................................... 59 3.2.3 interrupt immediately after reset......................................................................... 61 3.3 interrupts ................................................................................................................. .......... 61 3.3.1 overview.............................................................................................................. 61 3.3.2 interrupt control registers................................................................................... 63 3.3.3 external interrupts................................................................................................ 71 3.3.4 internal interrupts................................................................................................. 72 3.3.5 interrupt operations ............................................................................................. 72 3.3.6 interrupt response time ...................................................................................... 77 3.4 application notes .......................................................................................................... ... 78 3.4.1 notes on stack area use...................................................................................... 78 3.4.2 notes on rewriting port mode registers............................................................. 79 section 4 clock pulse generators ................................................................................... 81 4.1 overview................................................................................................................... ........ 81 4.1.1 block diagram ..................................................................................................... 81 4.1.2 system clock and subclock................................................................................. 81 4.2 system clock generator.................................................................................................... 82 4.3 subclock generator......................................................................................................... .. 84 4.4 prescalers ................................................................................................................. ......... 85 4.5 note on oscillators........................................................................................................ .... 86 section 5 power-down modes ........................................................................................ 87 5.1 overview................................................................................................................... ........ 87 5.1.1 system control registers ..................................................................................... 90 5.2 sleep mode ................................................................................................................. ...... 94 5.2.1 transition to sleep mode..................................................................................... 94 5.2.2 clearing sleep mode............................................................................................ 94 5.2.3 clock frequency in sleep (medium-speed) mode .............................................. 95 5.3 standby mode ............................................................................................................... .... 95
rev. 6.00 sep 12, 2006 page xiii of xx 5.3.1 transition to standby mode................................................................................. 95 5.3.2 clearing standby mode........................................................................................ 95 5.3.3 oscillator settling time after standby mode is cleared ..................................... 96 5.4 watch mode................................................................................................................. ..... 96 5.4.1 transition to watch mode ................................................................................... 96 5.4.2 clearing watch mode .......................................................................................... 97 5.4.3 oscillator settling time after watch mode is cleared ........................................ 97 5.5 subsleep mode.............................................................................................................. .... 97 5.5.1 transition to subsleep mode ............................................................................... 97 5.5.2 clearing subsleep mode ...................................................................................... 98 5.6 subactive mode............................................................................................................. .... 98 5.6.1 transition to subactive mode .............................................................................. 98 5.6.2 clearing subactive mode..................................................................................... 98 5.6.3 operating frequency in subactive mode ............................................................. 99 5.7 active (medium-speed) mode.......................................................................................... 99 5.7.1 transition to active (medium-speed) mode ....................................................... 99 5.7.2 clearing active (medium-speed) mode .............................................................. 99 5.7.3 operating frequency in active (medium-speed) mode ...................................... 99 5.8 direct transfer ............................................................................................................ ...... 100 section 6 rom ..................................................................................................................... 103 6.1 overview................................................................................................................... ........ 103 6.1.1 block diagram ..................................................................................................... 103 6.2 prom mode.................................................................................................................. ... 104 6.2.1 setting to prom mode........................................................................................ 104 6.2.2 memory map ....................................................................................................... 104 6.3 programming................................................................................................................ ..... 105 6.3.1 writing and verifying .......................................................................................... 106 6.3.2 programming precautions .................................................................................... 109 6.3.3 reliability of programmed data........................................................................... 110 6.4 flash memory overview................................................................................................... 11 1 6.4.1 principle of flash memory operation.................................................................. 111 6.4.2 mode pin settings and rom space..................................................................... 112 6.4.3 features................................................................................................................ 112 6.4.4 block diagram ..................................................................................................... 113 6.4.5 pin configuration................................................................................................. 114 6.4.6 register configuration ......................................................................................... 114 6.5 flash memory register descriptions ................................................................................ 115 6.5.1 flash memory control register (flmcr) .......................................................... 115 6.5.2 erase block register 1 (ebr1) ........................................................................... 117 6.5.3 erase block register 2 (ebr2) ........................................................................... 118
rev. 6.00 sep 12, 2006 page xiv of xx 6.6 on-board programming modes ........................................................................................ 120 6.6.1 boot mode ........................................................................................................... 120 6.6.2 user program mode............................................................................................. 125 6.7 programming and erasing flash memory......................................................................... 127 6.7.1 program mode ..................................................................................................... 127 6.7.2 program-verify mode.......................................................................................... 128 6.7.3 programming flowchart and sample program..................................................... 129 6.7.4 erase mode .......................................................................................................... 132 6.7.5 erase-verify mode............................................................................................... 132 6.7.6 erase flowcharts and sample programs .............................................................. 133 6.7.7 prewrite-verify mode .......................................................................................... 147 6.7.8 protect modes ...................................................................................................... 148 6.7.9 interrupt handling during flash memory programming/erasing......................... 149 6.8 flash memory prom mode (h8/3644f, h8/3643f, and h8/3642af) ........................... 150 6.8.1 prom mode setting............................................................................................ 150 6.8.2 memory map ....................................................................................................... 150 6.8.3 operation in prom mode................................................................................... 151 6.9 flash memory programming and erasing precautions ..................................................... 160 section 7 ram ..................................................................................................................... 167 7.1 overview................................................................................................................... ........ 167 7.1.1 block diagram ..................................................................................................... 167 section 8 i/o ports .............................................................................................................. 169 8.1 overview................................................................................................................... ........ 169 8.2 port 1..................................................................................................................... ............ 171 8.2.1 overview.............................................................................................................. 17 1 8.2.2 register configuration and description............................................................... 171 8.2.3 pin functions ....................................................................................................... 175 8.2.4 pin states.............................................................................................................. 176 8.2.5 mos input pull-up.............................................................................................. 176 8.3 port 2..................................................................................................................... ............ 177 8.3.1 overview.............................................................................................................. 17 7 8.3.2 register configuration and description............................................................... 177 8.3.3 pin functions ....................................................................................................... 179 8.3.4 pin states.............................................................................................................. 179 8.4 port 3..................................................................................................................... ............ 180 8.4.1 overview.............................................................................................................. 18 0 8.4.2 register configuration and description............................................................... 180 8.4.3 pin functions ....................................................................................................... 184 8.4.4 pin states.............................................................................................................. 185
rev. 6.00 sep 12, 2006 page xv of xx 8.4.5 mos input pull-up.............................................................................................. 185 8.5 port 5..................................................................................................................... ............ 186 8.5.1 overview.............................................................................................................. 18 6 8.5.2 register configuration and description............................................................... 186 8.5.3 pin functions ....................................................................................................... 188 8.5.4 pin states.............................................................................................................. 189 8.5.5 mos input pull-up.............................................................................................. 189 8.6 port 6..................................................................................................................... ............ 190 8.6.1 overview.............................................................................................................. 19 0 8.6.2 register configuration and description............................................................... 190 8.6.3 pin functions ....................................................................................................... 191 8.6.4 pin states.............................................................................................................. 192 8.7 port 7..................................................................................................................... ............ 192 8.7.1 overview.............................................................................................................. 19 2 8.7.2 register configuration and description............................................................... 192 8.7.3 pin functions ....................................................................................................... 194 8.7.4 pin states.............................................................................................................. 195 8.8 port 8..................................................................................................................... ............ 195 8.8.1 overview.............................................................................................................. 19 5 8.8.2 register configuration and description............................................................... 196 8.8.3 pin functions ....................................................................................................... 197 8.8.4 pin states.............................................................................................................. 198 8.9 port 9..................................................................................................................... ............ 199 8.9.1 overview.............................................................................................................. 19 9 8.9.2 register configuration and description............................................................... 199 8.9.3 pin functions ....................................................................................................... 200 8.9.4 pin states.............................................................................................................. 201 8.10 port b .................................................................................................................... ............ 201 8.10.1 overview.............................................................................................................. 2 01 8.10.2 register configuration and description............................................................... 201 8.10.3 pin functions ....................................................................................................... 202 8.10.4 pin states.............................................................................................................. 202 section 9 timers .................................................................................................................. 203 9.1 overview................................................................................................................... ........ 203 9.2 timer a.................................................................................................................... ......... 204 9.2.1 overview.............................................................................................................. 20 4 9.2.2 register descriptions ........................................................................................... 206 9.2.3 timer operation................................................................................................... 208 9.2.4 timer a operation states..................................................................................... 209 9.3 timer b1 ................................................................................................................... ........ 209
rev. 6.00 sep 12, 2006 page xvi of xx 9.3.1 overview.............................................................................................................. 20 9 9.3.2 register descriptions ........................................................................................... 211 9.3.3 timer operation................................................................................................... 213 9.3.4 timer b1 operation states................................................................................... 214 9.4 timer v.................................................................................................................... ......... 215 9.4.1 overview.............................................................................................................. 21 5 9.4.2 register descriptions ........................................................................................... 218 9.4.3 timer operation................................................................................................... 224 9.4.4 timer v operation modes ................................................................................... 229 9.4.5 interrupt sources.................................................................................................. 229 9.4.6 application examples .......................................................................................... 229 9.4.7 application notes ................................................................................................ 232 9.5 timer x.................................................................................................................... ......... 238 9.5.1 overview.............................................................................................................. 23 8 9.5.2 register descriptions ........................................................................................... 242 9.5.3 cpu interface....................................................................................................... 253 9.5.4 timer operation................................................................................................... 256 9.5.5 timer x operation modes ................................................................................... 263 9.5.6 interrupt sources.................................................................................................. 263 9.5.7 timer x application example ............................................................................. 264 9.5.8 application notes ................................................................................................ 265 9.6 watchdog timer ............................................................................................................. .. 270 9.6.1 overview.............................................................................................................. 27 0 9.6.2 register descriptions ........................................................................................... 271 9.6.3 timer operation................................................................................................... 274 9.6.4 watchdog timer operation states ....................................................................... 275 section 10 serial communication interface ................................................................ 277 10.1 overview.................................................................................................................. ......... 277 10.2 sci1 ..................................................................................................................... ............ 277 10.2.1 overview.............................................................................................................. 2 77 10.2.2 register descriptions ........................................................................................... 279 10.2.3 operation in synchronous mode.......................................................................... 284 10.2.4 operation in ssb mode ....................................................................................... 287 10.2.5 interrupts.............................................................................................................. 289 10.3 sci3 ..................................................................................................................... ............ 289 10.3.1 overview.............................................................................................................. 2 89 10.3.2 register descriptions ........................................................................................... 292 10.3.3 operation ............................................................................................................. 3 09 10.3.4 operation in asynchronous mode ....................................................................... 313 10.3.5 operation in synchronous mode.......................................................................... 322
rev. 6.00 sep 12, 2006 page xvii of xx 10.3.6 multiprocessor communication function ............................................................ 329 10.3.7 interrupts.............................................................................................................. 336 10.3.8 application notes ................................................................................................ 337 section 11 14-bit pwm ..................................................................................................... 341 11.1 overview.................................................................................................................. ......... 341 11.1.1 features................................................................................................................ 341 11.1.2 block diagram ..................................................................................................... 341 11.1.3 pin configuration................................................................................................. 342 11.1.4 register configuration ......................................................................................... 342 11.2 register descriptions ..................................................................................................... ... 342 11.2.1 pwm control register (pwcr).......................................................................... 342 11.2.2 pwm data registers u and l (pwdru, pwdrl)............................................ 343 11.3 operation................................................................................................................. .......... 344 section 12 a/d converter ................................................................................................. 345 12.1 overview.................................................................................................................. ......... 345 12.1.1 features................................................................................................................ 345 12.1.2 block diagram ..................................................................................................... 346 12.1.3 pin configuration................................................................................................. 347 12.1.4 register configuration ......................................................................................... 347 12.2 register descriptions ..................................................................................................... ... 348 12.2.1 a/d result register (adrr)............................................................................... 348 12.2.2 a/d mode register (amr) ................................................................................. 348 12.2.3 a/d start register (adsr).................................................................................. 350 12.3 operation................................................................................................................. .......... 351 12.3.1 a/d conversion operation .................................................................................. 351 12.3.2 start of a/d conversion by external trigger input ............................................. 351 12.4 interrupts ................................................................................................................ ........... 352 12.5 typical use ............................................................................................................... ........ 352 12.6 application notes ......................................................................................................... .... 355 section 13 electrical characteristics .............................................................................. 357 13.1 absolute maximum ratings.............................................................................................. 357 13.2 electrical characteristics (ztat?, mask rom version)............................................... 358 13.2.1 power supply voltage and operating range ....................................................... 358 13.2.2 dc characteristics (hd6473644) ........................................................................ 361 13.2.3 ac characteristics (hd6473644) ........................................................................ 367 13.2.4 dc characteristics (hd6433644, hd6433643, hd6433642, hd6433641, hd6433640) ........................................................................................................ 371
rev. 6.00 sep 12, 2006 page xviii of xx 13.2.5 ac characteristics (hd6433644, hd6433643, hd6433642, hd6433641, hd6433640) ........................................................................................................ 376 13.2.6 a/d converter characteristics ............................................................................. 381 13.3 electrical characteristics (ztat and r of the mask rom version) ............................... 382 13.3.1 power supply voltage and operating range ....................................................... 382 13.3.2 dc characteristics (hd6473644r) ..................................................................... 385 13.3.3 ac characteristics (hd6473644r) ..................................................................... 391 13.3.4 dc characteristics (hd6433644r, hd6433643r, hd6433642r, hd6433641r, hd6433640r)...................................................................................................... 395 13.3.5 ac characteristics (hd6433644r, hd6433643r, hd6433642r, hd6433641r, hd6433640r) ............................................................................. 400 13.3.6 a/d converter characteristics ............................................................................. 405 13.4 electrical characteristics (f-ztat ? version) ................................................................. 406 13.4.1 power supply voltage and operating range ....................................................... 406 13.4.2 dc characteristics (hd64f3644, HD64F3643, hd64f3642a) ......................... 409 13.4.3 ac characteristics (hd64f3644, HD64F3643, hd64f3642a) ......................... 415 13.4.4 a/d converter characteristics ............................................................................. 419 13.5 operation timing.......................................................................................................... .... 420 13.6 output load circuit ....................................................................................................... ... 423 appendix a cpu instruction set .................................................................................... 425 a.1 instructions............................................................................................................... ......... 425 a.2 operation code map......................................................................................................... 433 a.3 number of execution states.............................................................................................. 43 5 appendix b internal i/o registers ................................................................................. 442 b.1 addresses .................................................................................................................. ........ 442 b.2 functions.................................................................................................................. ......... 446 appendix c i/o port block diagrams ........................................................................... 493 c.1 block diagrams of port 1.................................................................................................. 493 c.2 block diagrams of port 2.................................................................................................. 497 c.3 block diagrams of port 3.................................................................................................. 500 c.4 block diagrams of port 5.................................................................................................. 503 c.5 block diagram of port 6 ................................................................................................... 506 c.6 block diagrams of port 7.................................................................................................. 507 c.7 block diagrams of port 8.................................................................................................. 511 c.8 block diagram of port 9 ................................................................................................... 519 c.9 block diagram of port b................................................................................................... 520 appendix d port states in the different processing states ..................................... 521
rev. 6.00 sep 12, 2006 page xix of xx appendix e product code lineup .................................................................................. 522 appendix f package dimensions ................................................................................... 524
rev. 6.00 sep 12, 2006 page xx of xx
section 1 overview rev. 6.00 sep 12, 2006 page 1 of 526 rej09b0326-0600 section 1 overview 1.1 overview the h8/300l series is a series of single-chip microcomputers (mcu: microcomputer unit), built around the high-speed h8/300l cpu and equipped with peripheral system functions on-chip. within the h8/300l series, the h8/3644 group of microcomputers are equipped with a uart (universal asynchronous receiver/transmitter). other on-chip peripheral functions include five timers, a 14-bit pulse width modulator (pwm), two serial communication interface channels, and an a/d converter, providing an ideal configuration as a microcomputer for embedding in high- level control systems. in addition to the mask rom version, the h8/3644 is also available in a ztat? * 1 version with on-chip user-programmable prom, and an f-ztat? * 2 version with on- chip flash memory that can be programmed on-board. table 1 summarizes the features of the h8/3644 group. notes: 1. ztat is a trademark of renesas technology corp. 2. f-ztat is a trademark of renesas technology corp.
section 1 overview rev. 6.00 sep 12, 2006 page 2 of 526 rej09b0326-0600 table 1.1 features item description cpu high-speed h8/300l cpu ? general-register architecture general registers: sixteen 8-bit registers (can be used as eight 16-bit registers) ? operating speed ? max. operation speed: 5 mhz (mask rom and ztat versions) 8 mhz (applies only to f-ztat, r of the ztat, and r of the mask rom version) ? add/subtract: 0.4 s (operating at = 5 mhz) 0.25 s (operating at = 8 mhz) * 1 ? multiply/divide: 2.8 s (operating at = 5 mhz) 1.75 s (operating at = 8 mhz) * 1 ? can run on 32.768 khz subclock ? instruction set compatible with h8/300 cpu ? instruction length of 2 bytes or 4 bytes ? basic arithmetic operations between registers ? mov instruction for data transfer between memory and registers ? typical instructions ? multiply (8 bits 8 bits) ? divide (16 bits 8 bits) ? bit accumulator ? register-indirect designation of bit position interrupts 33 interrupt sources ? 12 external interrupt sources (irq 3 to irq 0 , int 7 to int 0 ) ? 21 internal interrupt sources clock pulse generators two on-chip clock pulse generators ? system clock pulse generator: 1 to 10 mhz (1 to 16 mhz * 1 ) ? crystal or ceramic resonator: 2 to 10 mhz (2 to 16 mhz * 1 ) ? external clock input: 1 to 10 mhz (1 to 16 mhz * 1 ) ? subclock pulse generator: 32.768 khz
section 1 overview rev. 6.00 sep 12, 2006 page 3 of 526 rej09b0326-0600 item description power-down modes seven power-down modes ? sleep (high-speed) mode ? sleep (medium-speed) mode ? standby mode ? watch mode ? subsleep mode ? subactive mode ? active (medium-speed) mode memory large on-chip memory ? h8/3644: 32-kbyte rom, 1-kbyte ram ? h8/3643: 24-kbyte rom, 1-kbyte ram ? h8/3642: 16-kbyte rom, 512 byte ram (1-kbyte ram f-ztat version) ? h8/3641: 12-kbyte rom, 512 byte ram ? h8/3640: 8-kbyte rom, 512 byte ram i/o ports 53 pins ? 45 i/o pins ? 8 input pins timers five on-chip timers ? timer a: 8-bit timer count-up timer with selection of eight internal clock signals divided from the system clock ( ) * 2 and four clock signals divided from the watch clock ( w ) * 2 ? timer b1: 8-bit timer ? count-up timer with selection of seven internal clock signals or event input from external pin ? auto-reloading ? timer v: 8-bit timer ? count-up timer with selection of six internal clock signals or event input from external pin ? compare-match waveform output ? externally triggerable
section 1 overview rev. 6.00 sep 12, 2006 page 4 of 526 rej09b0326-0600 item description timers ? timer x: 16-bit timer ? count-up timer with selection of three internal clock signals or event input from external pin ? output compare (2 output pins) ? input capture (4 input pins) ? watchdog timer ? reset signal generated by 8-bit counter overflow serial communication interface two on-chip serial communication interface channels ? sci1: synchronous serial interface choice of 8-bit or 16-bit data transfer ? sci3: 8-bit synchronous/asynchronous serial interface incorporates multiprocessor communication function 14-bit pwm pulse-division pwm output for reduced ripple ? can be used as a 14-bit d/a converter by connecting to an external low-pass filter. a/d converter successive approximations using a resistance ladder ? 8-channel analog input pins ? conversion time: 31/ or 62/ per channel
section 1 overview rev. 6.00 sep 12, 2006 page 5 of 526 rej09b0326-0600 item description product lineup product code mask rom version ztat? version f-ztat? version package rom/ram size hd6433644h hd6433644rh hd6473644h hd6473644rh hd64f3644h 64-pin qfp (fp-64a) rom: 32 kbytes ram: 1 kbyte hd6433644p hd6433644rp hd6473644p hd6473644rp hd64f3644p 64-pin sdip (dp-64s) hd6433644w hd6433644rw hd6473644w hd6473644rw hd64f3644w 80-pin tqfp (tfp-80c) hd6433643h hd6433643rh ? HD64F3643h 64-pin qfp (fp-64a) rom: 24 kbytes ram: 1 kbyte hd6433643p hd6433643rp ? HD64F3643p 64-pin sdip (dp-64s) hd6433643w hd6433643rw ? HD64F3643w 80-pin tqfp (tfp-80c) hd6433642h hd6433642rh ? hd64f3642ah 64-pin qfp (fp-64a) rom: 16 kbytes ram: 512 kbytes hd6433642p hd6433642rp ? hd64f3642ap 64-pin sdip (dp-64s) ram: 1 kbyte (f-ztat version) hd6433642w hd6433642rw ? hd64f3642aw 80-pin tqfp (tfp-80c) hd6433641h hd6433641rh ? ? 64-pin qfp (fp-64a) rom: 12 kbytes ram: 512 bytes hd6433641p hd6433641rp ? ? 64-pin sdip (dp-64s) hd6433641w hd6433641rw ? ? 80-pin tqfp (tfp-80c) hd6433640h hd6433640rh ? ? 64-pin qfp (fp-64a) rom: 8 kbytes ram: 512 bytes hd6433640p hd6433640rp ? ? 64-pin sdip (dp-64s) hd6433640w hd6433640rw ? ? 80-pin tqfp (tfp-80c) notes: 1. applies only to f-ztat, r of the ztat, and r of the mask rom version. 2. as for the definition of and w , see section 4, clock pulse generators.
section 1 overview rev. 6.00 sep 12, 2006 page 6 of 526 rej09b0326-0600 1.2 internal block diagram figure 1.1 shows a block diagram of the h8/3644 group. port 8 p8 7 p8 6 /ftid p8 5 /ftic p8 4 /ftib p8 3 /ftia p8 2 /ftob p8 1 /ftoa p8 0 /ftci rom port 7 p7 7 p7 6 /tmov p7 5 /tmciv p7 4 /tmriv p7 3 port 6 p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 cmos large- current port i ol = 10 ma @v ol = 1v p5 7 / int 7 p5 6 / int 6 /tmib p5 5 / int 5 / adtrg p5 4 / int 4 p5 3 / int 3 p5 2 / int 2 p5 1 / int 1 p5 0 / int 0 port 1 p1 0 /tmow p1 4 /pwm p1 5 / irq 1 p1 6 / irq 2 p1 7 / irq 3 /trgv port 2 p2 0 /sck 3 p2 1 /rxd p2 2 /txd port 3 p3 0 /sck 1 p3 1 /si 1 p3 2 /so 1 p9 0 /fv pp * p9 1 p9 2 p9 3 p9 4 port 9 pb 0 /an 0 pb 1 /an 1 pb 2 /an 2 pb 3 /an 3 pb 4 /an 4 pb 5 /an 5 pb 6 /an 6 pb 7 /an 7 v ss v cc res irq 0 test osc 1 osc 2 x 1 x 2 cpu h8/300l data bus (lower) system clock generator subclock generator ram timer a sci1 timer b1 watchdog timer a/d converter sci3 timer x timer v 14-bit pwm av cc av ss port 5 port b data bus (upper) address bus note: * there is no p9 0 function in the flash memory version. figure 1.1 block diagram
section 1 overview rev. 6.00 sep 12, 2006 page 7 of 526 rej09b0326-0600 1.3 pin arrangement and functions 1.3.1 pin arrangement the h8/3644 group pin arrangement is shown in figures 1.2 (fp-64a), 1.3 (dp-64s), and 1.4 (tfp-80c). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 p5 7 / int 7 p5 6 / int 6 /tmib p5 5 / int 5 / adtrg p5 4 /int 4 p5 3 /int 3 p5 2 / int 2 p5 1 / int 1 p5 0 / int 0 p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 p2 1 /rxd p2 0 /sck 3 p8 7 p8 6 /ftid p8 5 /ftic p8 4 /ftib p8 3 /ftia p8 2 /ftob p8 1 /ftoa p8 0 /ftci p7 7 p7 6 /tmov p7 5 /tmciv p7 4 /tmriv p7 3 v cc pb 1 /an 1 pb 0 /an 0 av ss test x 2 x 1 v ss osc 1 osc 2 res p9 0 /fv pp * p9 1 p9 2 p9 3 p9 4 irq 0 p2 2 /txd p3 2 /so 1 p3 1 /si 1 p3 0 /sck 1 p1 0 /tmow p1 4 /pwm p1 5 / irq 1 p1 6 / irq 2 p1 7 / irq 3 /trgv av cc pb 7 /an 7 pb 6 /an 6 pb 5 /an 5 pb 4 /an 4 pb 3 /an 3 pb 2 /an 2 note: * there is no p9 0 function in the flash memory version. figure 1.2 pin arrangement (fp-64a: top view)
section 1 overview rev. 6.00 sep 12, 2006 page 8 of 526 rej09b0326-0600 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 p1 6 / irq 2 p1 5 / irq 1 p1 4 /pwm p1 0 /tmow p3 0 /sck 1 p3 1 /si 1 p3 2 /so 1 p2 2 /txd p2 1 /rxd p2 0 /sck 3 p8 7 p8 6 /ftid p8 5 /ftic p8 4 /ftib p8 3 /ftia p8 2 /ftob p8 1 /ftoa p8 0 /ftci p7 7 p7 6 /tmov p7 5 /tmciv p7 4 /tmriv p7 3 v cc p5 7 / int 7 p5 6 / int 6 /tmib p5 5 / int 5 / adtrg p5 4 / int 4 p5 3 / int 3 p5 2 / int 2 p5 1 / int 1 p5 0 / int 0 p1 7 / irq 3 /trgv av cc pb 7 /an 7 pb 6 /an 6 pb 5 /an 5 pb 4 /an 4 pb 3 /an 3 pb 2 /an 2 pb 1 /an 1 pb 0 /an 0 av ss test x 2 x 1 v ss osc 1 osc 2 res p9 0 /fv pp * p9 1 p9 2 p9 3 p9 4 irq 0 p6 0 p6 1 p6 2 p6 3 p6 4 p6 5 p6 6 p6 7 note: * there is no p9 0 function in the flash memory version. figure 1.3 pin arrangement (dp-64s: top view)
section 1 overview rev. 6.00 sep 12, 2006 page 9 of 526 rej09b0326-0600 nc pb 1 /an 1 pb 0 /an 0 av ss test x 2 x 1 v ss1 osc 1 osc 2 v ss2 res p9 0 /fv pp * p9 1 p9 2 nc p9 3 p9 4 irq 0 nc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 nc p2 1 /rxd p2 0 /sck 3 p8 7 p8 6 /ftid p8 5 /ftic p8 4 /ftib nc p8 3 /ftia p8 2 /ftob p8 1 /ftoa p8 0 /ftci nc p7 7 p7 6 /tmov p7 5 /tmciv p7 4 /tmriv p7 3 v cc nc 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 nc nc p2 2 /txd p3 2 /so 1 p3 1 /si 1 p3 0 /sck 1 p1 0 /tmow p1 4 /pwm p1 5 / irq 1 p1 6 / irq 2 p1 7 / irq 3 /trgv av cc pb 7 /an 7 pb 6 /an 6 pb 5 /an 5 pb 4 /an 4 pb 3 /an 3 pb 2 /an 2 nc nc nc nc p5 7 / int 7 p5 6 / int 6 /tmib p5 5 / int 5 / adtrg p5 4 / int 4 p5 3 / int 3 p5 2 / int 2 p5 1 / int 1 p5 0 / int 0 nc p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 nc 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 note: * there is no p9 0 function in the flash memory version. figure 1.4 pin arrangement (tfp-80c: top view)
section 1 overview rev. 6.00 sep 12, 2006 page 10 of 526 rej09b0326-0600 1.3.2 pin functions table 1.2 outlines the pin functions of the h8/3644 group. table 1.2 pin functions pin no. type symbol fp-64a dp-64s tfp-80c i/o name and functions power source pins v cc 33 41 42 input power supply: all v cc pins should be connected to the user system v cc . v ss 7 15 8, 11 input ground: all v ss pins should be connected to the user system gnd. av cc 58 2 72 input analog power supply: this is the power supply pin for the a/d converter. when the a/d converter is not used, connect this pin to the user system v cc . av ss 3 11 4 input analog ground: this is the a/d converter ground pin. it should be connected to the user system gnd. clock pins osc 1 8 16 9 input system clock: these pins connect to a crystal or ceramic resonator, or can be used to input an external clock. osc 2 9 17 10 output see section 4, clock pulse generators, for a typical connection diagram. x 1 6 14 7 input subclock: these pins connect to a 32.768-khz crystal resonator. x 2 5 13 6 output see section 4, clock pulse generators, for a typical connection diagram. system control res 10 18 12 input reset: when this pin is driven low, the chip is reset test 4 12 5 input test: this is a test pin, not for use in application systems. it should be connected to v ss .
section 1 overview rev. 6.00 sep 12, 2006 page 11 of 526 rej09b0326-0600 pin no. type symbol fp-64a dp-64s tfp-80c i/o name and functions interrupt pins irq 0 irq 1 irq 2 irq 3 16 55 56 57 24 63 64 1 19 69 70 71 input irq interrupt request 0 to 3: these are input pins for edge- sensitive external interrupts, with a selection of rising or falling edge int 7 to int 0 32 to 25 40 to 33 38 to 31 input int interrupt request 0 to 7: these are input pins for edge- sensitive external interrupts, with a selection of rising or falling edge timer pins tmow 53 61 67 output clock output: this is an output pin for waveforms generated by the timer a output circuit tmib 31 39 37 input timer b1 event counter input: this is an event input pin for input to the timer b1 counter tmov 37 45 46 output timer v output: this is an output pin for waveforms generated by the timer v output compare function tmciv 36 44 45 input timer v event input: this is an event input pin for input to the timer v counter tmriv 35 43 44 input timer v counter reset: this is a counter reset input pin for timer v trgv 57 1 71 input timer v counter trigger input: this is a trigger input pin for the timer v counter and realtime output port ftci 39 47 49 input timer x clock input: this is an external clock input pin for input to the timer x counter ftoa 40 48 50 output timer x output compare a output: this is an output pin for timer x output compare a ftob 41 49 51 output timer x output compare b output: this is an output pin for timer x output compare b
section 1 overview rev. 6.00 sep 12, 2006 page 12 of 526 rej09b0326-0600 pin no. type symbol fp-64a dp-64s tfp-80c i/o name and functions timer pins ftia 42 50 52 input timer x input capture a input: this is an input pin for timer x input capture a ftib 43 51 54 input timer x input capture b input: this is an input pin for timer x input capture b ftic 44 52 55 input timer x input capture c input: this is an input pin for timer x input capture c ftid 45 53 56 input timer x input capture d input: this is an input pin for timer x input capture d 14-bit pwm pin pwm 54 62 68 output 14-bit pwm output: this is an output pin for waveforms generated by the 14-bit pwm i/o ports pb 7 to pb 0 59 to 64, 1, 2 3 to 10 73 to 78 2, 3 input port b: this is an 8-bit input port p1 7 to p1 4 , p1 0 57 to 53 1, 64 to 61 71 to 67 i/o port 1: this is a 5-bit i/o port. input or output can be designated for each bit by means of port control register 1 (pcr1) p2 2 to p2 0 49 to 47 57 to 55 63, 59 58 i/o port 2: this is a 3-bit i/o port. input or output can be designated for each bit by means of port control register 2 (pcr2) p3 2 to p3 0 50 to 52 58 to 60 64 to 66 i/o port 3: this is a 3-bit i/o port. input or output can be designated for each bit by means of port control register 3 (pcr3) p5 7 to p5 0 32 to 25 40 to 33 38 to 31 i/o port 5: this is an 8-bit i/o port. input or output can be designated for each bit by means of port control register 5 (pcr5) p6 7 to p6 0 24 to 17 32 to 25 29 to 22 i/o port 6: this is an 8-bit i/o port. input or output can be designated for each bit by means of port control register 6 (pcr6)
section 1 overview rev. 6.00 sep 12, 2006 page 13 of 526 rej09b0326-0600 pin no. type symbol fp-64a dp-64s tfp-80c i/o name and functions i/o ports p7 7 to p7 3 38 to 34 46 to 42 47 to 43 i/o port 7: this is a 5-bit i/o port. input or output can be designated for each bit by means of port control register 7 (pcr7) p8 7 to p8 0 46 to 39 54 to 47 57 to 54, 52 to 49 i/o port 8: this is an 8-bit i/o port. input or output can be designated for each bit by means of port control register 8 (pcr8) p9 4 to p9 0 15 to 11 23 to 19 18, 17 15 to 13 i/o port 9: this is a 5-bit i/o port. input or output can be designated for each bit by means of port control register 9 (pcr9) note: there is no p9 0 function in the flash memory version since p9 0 is used as the fv pp pin. serial com- munication si 1 51 59 65 input sci1 receive data input: this is the sci1 data input pin interface (sci) so 1 50 58 64 output sci1 transmit data output: this is the sci1 data output pin sck 1 52 60 66 i/o sci1 clock i/o: this is the sci1 clock i/o pin rxd 48 56 59 input sci3 receive data input: this is the sci3 data input pin txd 49 57 63 output sci3 transmit data output: this is the sci3 data output pin sck 3 47 55 58 i/o sci3 clock i/o: this is the sci3 clock i/o pin a/d converter an 7 to an 0 59 to 64, 1, 2 3 to 10 73 to 78 2, 3 input analog input channels 11 to 0: these are analog data input channels to the a/d converter adtrg 30 38 36 input a/d converter trigger input: this is the external trigger input pin to the a/d converter
section 1 overview rev. 6.00 sep 12, 2006 page 14 of 526 rej09b0326-0600 pin no. type symbol fp-64a dp-64s tfp-80c i/o name and functions flash memory fv pp 11 19 13 input on-board-programmable flash memory power supply: connected to the flash memory programming power supply (+12 v). when the flash memory is not being programmed, connect to the user system v cc . in versions other than the on-chip flash memory version, this pin is p9 0 other nc ? ? 1, 16, 20, 21, 30, 39, 40, 41, 48, 53, 60 to 62, 79, 80 ? non-connected pins: these pins must be left unconnected
section 2 cpu rev. 6.00 sep 12, 2006 page 15 of 526 rej09b0326-0600 section 2 cpu 2.1 overview the h8/300l cpu has sixteen 8-bit general registers, which can also be paired as eight 16-bit registers. its concise instruction set is designed for high-speed operation. 2.1.1 features features of the h8/300l cpu are listed below. ? general-register architecture sixteen 8-bit general registers, also usable as eight 16-bit general registers ? instruction set with 55 basic instructions, including: ? multiply and divide instructions ? powerful bit-manipulation instructions ? eight addressing modes ? register direct ? register indirect ? register indirect with displacement ? register indirect with post-increment or pre-decrement ? absolute address ? immediate ? program-counter relative ? memory indirect ? 64-kbyte address space ? high-speed operation ? all frequently used instructions are executed in two to four states ? high-speed arithmetic and logic operations 8- or 16-bit register-register add or subtract: 0.4 s (operating at = 5 mhz) 0.25 s (operating at = 8 mhz)* 8 8-bit multiply: 2.8 s (operating at = 5 mhz) 1.75 s (operating at = 8 mhz)* 16 8-bit divide: 2.8 s (operating at = 5 mhz) 1.75 s (operating at = 8 mhz)* note: * applies only to f-ztat, r of the ztat, and r of the mask rom version.
section 2 cpu rev. 6.00 sep 12, 2006 page 16 of 526 rej09b0326-0600 ? low-power operation modes sleep instruction for transfer to low-power operation 2.1.2 address space the h8/300l cpu supports an address space of up to 64 kbytes for storing program code and data. see section 2.8, memory map, for details of the memory map. 2.1.3 register configuration figure 2.1 shows the register structure of the h8/300l cpu. there are two groups of registers: the general registers and control registers.
section 2 cpu rev. 6.00 sep 12, 2006 page 17 of 526 rej09b0326-0600 7070 15 0 pc r0h r1h r2h r3h r4h r5h r6h r7h r0l r1l r2l r3l r4l r5l r6l r7l (sp) sp: stack pointer pc: program counter ccr: condition code register carry flag overflow flag zero flag negative flag half-carry flag interrupt mask bit user bit user bit ccr i u h u n z v c general registers (rn) control registers (cr) 753210 64 figure 2.1 cpu registers
section 2 cpu rev. 6.00 sep 12, 2006 page 18 of 526 rej09b0326-0600 2.2 register descriptions 2.2.1 general registers all the general registers can be used as both data registers and address registers. when used as data registers, they can be accessed as 16-bit registers (r0 to r7), or the high bytes (r0h to r7h) and low bytes (r0l to r7l) can be accessed separately as 8-bit registers. when used as address registers, the general registers are accessed as 16-bit registers (r0 to r7). r7 also functions as the stack pointer (sp), used implicitly by hardware in exception processing and subroutine calls. when it functions as the stack pointer, as indicated in figure 2.2, sp (r7) points to the top of the stack. lower address side [h'0000] upper address side [h'ffff] unused area stack area sp (r7) figure 2.2 stack pointer 2.2.2 control registers the cpu control registers include a 16-bit program counter (pc) and an 8-bit condition code register (ccr). program counter (pc): this 16-bit register indicates the address of the next instruction the cpu will execute. all instructions are fetched 16 bits (1 word) at a time, so the least significant bit of the pc is ignored (always regarded as 0).
section 2 cpu rev. 6.00 sep 12, 2006 page 19 of 526 rej09b0326-0600 condition code register (ccr): this 8-bit register contains internal status information, including the interrupt mask bit (i) and half-carry (h), negative (n), zero (z), overflow (v), and carry (c) flags. these bits can be read and written by software (using the ldc, stc, andc, orc, and xorc instructions). the n, z, v, and c flags are used as branching conditions for conditional branching (bcc) instructions. bit 7 ? interrupt mask bit (i): when this bit is set to 1, interrupts are masked. this bit is set to 1 automatically at the start of exception handling. the interrupt mask bit may be read and written by software. for further details, see section 3.3, interrupts. bit 6 ? user bit (u): can be used freely by the user. bit 5 ? half-carry flag (h): when the add.b, addx.b, sub.b, subx.b, cmp.b, or neg.b instruction is executed, this flag is set to 1 if there is a carry or borrow at bit 3, and is cleared to 0 otherwise. the h flag is used implicitly by the daa and das instructions. when the add.w, sub.w, or cmp.w instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 11, and is cleared to 0 otherwise. bit 4 ? user bit (u): can be used freely by the user. bit 3vnegative flag (n): indicates the most significant bit (sign bit) of the result of an instruction. bit 2 ? zero flag (z): set to 1 to indicate a zero result, and cleared to 0 to indicate a non-zero result. bit 1 ? overflow flag (v): set to 1 when an arithmetic overflow occurs, and cleared to 0 at other times. bit 0 ? carry flag (c): set to 1 when a carry occurs, and cleared to 0 otherwise. used by: ? add instructions, to indicate a carry ? subtract instructions, to indicate a borrow ? shift/rotate carry the carry flag is also used as a bit accumulator by bit manipulation instructions. some instructions leave some or all of the flag bits unchanged.
section 2 cpu rev. 6.00 sep 12, 2006 page 20 of 526 rej09b0326-0600 refer to the h8/300l series programming manual for the action of each instruction on the flag bits. 2.2.3 initial register values in reset exception handling, the program counter (pc) is initialized by a vector address (h'0000) load, and the i bit in the ccr is set to 1. the other ccr bits and the general registers are not initialized. in particular, the stack pointer (r7) is not initialized. the stack pointer should be initialized by software, by the first instruction executed after a reset. 2.3 data formats the h8/300l cpu can process 1-bit data, 4-bit (bcd) data, 8-bit (byte) data, and 16-bit (word) data. the h8/300l cpu can process 1-bit, 4-bit bcd, 8-bit (byte), and 16-bit (word) data. 1-bit data is handled by bit manipulation instructions, and is accessed by being specified as bit n (n = 0, 1, 2, ... 7) in the operand data (byte). byte data is handled by all arithmetic and logic instructions except adds and subs. word data is handled by the mov.w, add.w, sub.w, cmp.w, adds, subs, mulxu (b bits 8 bits), and divxu (16 bits 8 bits) instructions. with the daa and das decimal adjustment instructions, byte data is handled as two 4-bit bcd data units.
section 2 cpu rev. 6.00 sep 12, 2006 page 21 of 526 rej09b0326-0600 2.3.1 data formats in general registers data of all the sizes above can be stored in general registers as shown in figure 2.3. 7 6 5 4 3 2 1 0 don?t care data type register no. data format 70 1-bit data rnh 76543210 don?t care 70 1-bit data rnl msb lsb don?t care 70 byte data rnh byte data rnl word data rn 4-bit bcd data rnh 4-bit bcd data rnl legend: rnh: rnl: msb: lsb: upper byte of general register lower byte of general register most significant bit least significant bit msb lsb don?t care 70 msb lsb 15 0 upper digit lower digit don?t care 70 3 4 don?t care upper digit lower digit 70 3 4 figure 2.3 general register data formats
section 2 cpu rev. 6.00 sep 12, 2006 page 22 of 526 rej09b0326-0600 2.3.2 memory data formats figure 2.4 indicates the data formats in memory. for access by the h8/300l cpu, word data stored in memory must always begin at an even address. when word data beginning at an odd address is accessed, the least significant bit is regarded as 0, and the word data beginning at the preceding address is accessed. the same applies to instruction codes. data format 76543210 address data type 70 address n msb lsb msb lsb upper 8 bits lower 8 bits msb lsb ccr ccr * msb lsb msb lsb address n even address odd address even address odd address even address odd address 1-bit data byte data word data byte data (ccr) on stack word data on stack legend: ccr: condition code register note: * ignored on return figure 2.4 memory data formats when the stack is accessed using r7 as an address register, word access should always be performed. the ccr is stored as word data with the same value in the upper 8 bits and the lower 8 bits. on return, the lower 8 bits are ignored.
section 2 cpu rev. 6.00 sep 12, 2006 page 23 of 526 rej09b0326-0600 2.4 addressing modes 2.4.1 addressing modes the h8/300l cpu supports the eight addressing modes listed in table 2.1. each instruction uses a subset of these addressing modes. table 2.1 addressing modes no. address modes symbol 1 register direct rn 2 register indirect @rn 3 register indirect with displacement @(d:16, rn) 4 register indirect with post-increment register indirect with pre-decrement @rn+ @?rn 5 absolute address @aa:8 or @aa:16 6 immediate #xx:8 or #xx:16 7 program-counter relative @(d:8, pc) 8 memory indirect @@aa:8 1. register direct ? rn: the register field of the instruction specifies an 8- or 16-bit general register containing the operand. only the mov.w, add.w, sub.w, cmp.w, adds, subs, mulxu (8 bits 8 bits), and divxu (16 bits 8 bits) instructions have 16-bit operands. 2. register indirect ? @rn: the register field of the instruction specifies a 16-bit general register containing the address of the operand in memory. 3. register indirect with displacement ? @(d:16, rn): the instruction has a second word (bytes 3 and 4) containing a displacement which is added to the contents of the specified general register to obtain the operand address in memory. this mode is used only in mov instructions. for the mov.w instruction, the resulting address must be even. 4. register indirect with post-increment or pre-decrement ? @rn+ or @?rn: ? register indirect with post-increment ? @rn+ the @rn+ mode is used with mov instructions that load registers from memory. the register field of the instruction specifies a 16-bit general register containing the address of the operand. after the operand is accessed, the register is incremented by 1 for mov.b or 2 for mov.w, and the result of the addition is stored in the register. for mov.w, the original contents of the 16-bit general register must be even.
section 2 cpu rev. 6.00 sep 12, 2006 page 24 of 526 rej09b0326-0600 ? register indirect with pre-decrement ? @?rn the @?rn mode is used with mov instructions that store register contents to memory. the register field of the instruction specifies a 16-bit general register which is decremented by 1 or 2 to obtain the address of the operand in memory. the register retains the decremented value. the size of the decrement is 1 for mov.b or 2 for mov.w. for mov.w, the original contents of the register must be even. 5. absolute address ? @aa:8 or @aa:16: the instruction specifies the absolute address of the operand in memory. the absolute address may be 8 bits long (@aa:8) or 16 bits long (@aa:16). the mov.b and bit manipulation instructions can use 8-bit absolute addresses. the mov.b, mov.w, jmp, and jsr instructions can use 16-bit absolute addresses. for an 8-bit absolute address, the upper 8 bits are assumed to be 1 (h'ff). the address range is h'ff00 to h'ffff (65280 to 65535). 6. immediate ? #xx:8 or #xx:16: the second byte (#xx:8) or the third and fourth bytes (#xx:16) of the instruction code are used directly as the operand. only mov.w instructions can be used with #xx:16. the adds and subs instructions implicitly contain the value 1 or 2 as immediate data. some bit manipulation instructions contain 3-bit immediate data in the second or fourth byte of the instruction, specifying a bit number. 7. program-counter relative ? @(d:8, pc): this mode is used in the bcc and bsr instructions. an 8-bit displacement in byte 2 of the instruction code is sign-extended to 16 bits and added to the program counter contents to generate a branch destination address, and the pc contents to be added are the start address of the next instruction, so that the possible branching range is ?126 to +128 bytes (?63 to +64 words) from the branch instruction. the displacement should be an even number. 8. memory indirect ? @@aa:8: this mode can be used by the jmp and jsr instructions. the second byte of the instruction code specifies an 8-bit absolute address. this specifies an operand in memory, and a branch is performed with the contents of this operand as the branch address. the upper 8 bits of the absolute address are assumed to be 0 (h'00), so the address range is from h'0000 to h'00ff (0 to 255). note that with the h8/300l series, the lower end of the address area is also used as a vector area. see section 3.3, interrupts, for details on the vector area. if an odd address is specified as a branch destination or as the operand address of a mov.w instruction, the least significant bit is regarded as 0, causing word access to be performed at the address preceding the specified address. see section 2.3.2, memory data formats, for further information.
section 2 cpu rev. 6.00 sep 12, 2006 page 25 of 526 rej09b0326-0600 2.4.2 effective address calculation table 2.2 shows how effective addresses are calculated in each of the addressing modes. arithmetic and logic instructions use register direct addressing (1). the add.b, addx, subx, cmp.b, and, or, and xor instructions can also use immediate addressing (6). data transfer instructions can use all addressing modes except program-counter relative (7) and memory indirect (8). bit manipulation instructions use register direct (1), register indirect (2), or 8-bit absolute addressing (5) to specify a byte operand, and 3-bit immediate addressing (6) to specify a bit position in that byte. the bset, bclr, bnot, and btst instructions can also use register direct addressing (1) to specify the bit position.
section 2 cpu rev. 6.00 sep 12, 2006 page 26 of 526 rej09b0326-0600 table 2.2 effective address calculation no. addressing mode and instruction format effective address calculation method effective address (ea) 1 register indirect, rn operand is contents of registers indicated by rm/rn op rm rn 87 3 40 15 rm 30 rn 30 2 op rm 76 3 40 15 register indirect, @rn contents (16 bits) of register indicated by rm 0 15 0 15 3 register indirect with displacement, @(d:16, rn) op rm 76 3 40 15 disp 0 15 disp 0 15 contents (16 bits) of register indicated by rm 4 op rm 76 3 40 15 register indirect with post-increment, @rn+ op rm 76 3 40 15 register indirect with pre-decrement, @ ? rn incremented or decremented by 1 if operand is byte size, and by 2 if word size 0 15 1 or 2 0 15 0 15 1 or 2 0 15 contents (16 bits) of register indicated by rm contents (16 bits) of register indicated by rm
section 2 cpu rev. 6.00 sep 12, 2006 page 27 of 526 rej09b0326-0600 no. addressing mode and instruction format effective address calculation method effective address (ea) 5 absolute address @aa:8 @aa:16 op 87 0 15 0 15 abs h'ff 87 0 15 0 15 abs op 6 op 0 15 imm #xx:16 op 87 0 15 imm immediate #xx:8 operand is 1- or 2-byte immediate data 7 op disp 70 15 program-counter relative @(d:8, pc) pc contents 0 15 0 15 8 sign extension disp
section 2 cpu rev. 6.00 sep 12, 2006 page 28 of 526 rej09b0326-0600 no. addressing mode and instruction format effective address calculation method effective address (ea) 8 memory indirect, @@aa:8 op 87 0 15 memory contents (16 bits) 0 15 abs h'00 87 0 15 abs legend: rm, rn: register field op: operation field disp: displacement imm: immediate data abs: absolute address
section 2 cpu rev. 6.00 sep 12, 2006 page 29 of 526 rej09b0326-0600 2.5 instruction set the h8/300l series can use a total of 55 instructions, which are grouped by function in table 2.3. table 2.3 instruction set function instructions number data transfer mov, push * 1 , pop * 1 1 arithmetic operations add, sub, addx, subx, inc, dec, adds, subs, daa, das, mulxu, divxu, cmp, neg 14 logic operations and, or, xor, not 4 shift shal, shar, shll, shlr, rotl, rotr, rotxl, rotxr 8 bit manipulation bset, bclr, bnot, btst, band, biand, bor, bior, bxor, bixor, bld, bild, bst, bist 14 branch bcc * 2 , jmp, bsr, jsr, rts 5 system control rte, sleep, ldc, stc, andc, orc, xorc, nop 8 block data transfer eepmov 1 total: 55 notes: 1. push rn is equivalent to mov.w rn, @?sp. pop rn is equivalent to mov.w @sp+, rn. 2. bcc is a conditional branch instruction. the same applies to machine language. tables 2.4 to 2.11 show the function of each instruction. the notation used is defined next.
section 2 cpu rev. 6.00 sep 12, 2006 page 30 of 526 rej09b0326-0600 notation rd general register (destination) rs general register (source) rn general register (ead), destination operand (eas), source operand ccr condition code register n n (negative) flag of ccr z z (zero) flag of ccr v v (overflow) flag of ccr c c (carry) flag of ccr pc program counter sp stack pointer #imm immediate data disp displacement + addition ? subtraction multiplication division and logical or logical exclusive or logical move ~ logical negation (logical complement) :3 3-bit length :8 8-bit length :16 16-bit length ( ), < > contents of operand indicated by effective address
section 2 cpu rev. 6.00 sep 12, 2006 page 31 of 526 rej09b0326-0600 2.5.1 data transfer instructions table 2.4 describes the data transfer instructions. figure 2.5 shows their object code formats. table 2.4 data transfer instructions instruction size * function mov b/w (eas) rd, rs (ead) moves data between two general registers or between a general register and memory, or moves immediate data to a general register. the rn, @rn, @(d:16, rn), @aa:16, #xx:16, @?rn, and @rn+ addressing modes are available for word data. the @aa:8 addressing mode is available for byte data only. the @?r7 and @r7+ modes require a word-size specification. pop w @sp+ rn pops a general register from the stack. equivalent to mov.w @sp+, rn. push w rn @?sp pushes general register onto the stack. equivalent to mov.w rn, @?sp. notes: * size: operand size b: byte w: word certain precautions are required in data access. see section 2.9.1, notes on data access, for details.
section 2 cpu rev. 6.00 sep 12, 2006 page 32 of 526 rej09b0326-0600 15 0 87 op rm rn mov rm rn 15 0 87 op rm rn @rm rn 15 0 87 op rm rn @(d:16, rm) rn disp 15 0 87 op rm rn @rm+ rn, or rn @ ? rm 15 0 87 op rn abs @aa:8 rn 15 0 87 op rn @aa:16 rn abs 15 0 87 op rn imm #xx:8 rn 15 0 87 op rn #xx:16 rn imm 15 0 87 op rn push, pop legend: op: rm, rn: disp: abs: imm: operation field register field displacement absolute address immediate data @sp+ rn, or rn @ ? sp 111 figure 2.5 data transfer instruction codes
section 2 cpu rev. 6.00 sep 12, 2006 page 33 of 526 rej09b0326-0600 2.5.2 arithmetic operations table 2.5 describes the arithmetic instructions. table 2.5 arithmetic instructions instruction size * function add sub b/w rd rs rd, rd + #imm rd performs addition or subtraction on data in two general registers, or addition on immediate data and data in a general register. immediate data cannot be subtracted from data in a general register. word data can be added or subtracted only when both words are in general registers. addx subx b rd rs c rd, rd #imm c rd performs addition or subtraction with carry on data in two general registers, or addition or subtraction with carry on immediate data and data in a general register. inc dec b rd 1 rd increments or decrements a general register adds subs w rd 1 rd, rd 2 rd adds or subtracts 1 or 2 to or from a general register daa das b rd decimal adjust rd decimal-adjusts (adjusts to packed bcd) an addition or subtraction result in a general register by referring to the ccr mulxu b rd rs rd performs 8-bit 8-bit unsigned multiplication on data in two general registers, providing a 16-bit result divxu b rd rs rd performs 16-bit 8-bit unsigned division on data in two general registers, providing an 8-bit quotient and 8-bit remainder cmp b/w rd ? rs, rd ? #imm compares data in a general register with data in another general register or with immediate data, and indicates the result in the ccr. word data can be compared only between two general registers. neg b 0 ? rd rd obtains the two?s complement (arithmetic complement) of data in a general register notes: * size: operand size b: byte w: word
section 2 cpu rev. 6.00 sep 12, 2006 page 34 of 526 rej09b0326-0600 2.5.3 logic operations table 2.6 describes the four instructions that perform logic operations. table 2.6 logic operation instructions instruction size * function and b rd rs rd, rd #imm rd performs a logical and operation on a general register and another general register or immediate data or b rd rs rd, rd #imm rd performs a logical or operation on a general register and another general register or immediate data xor b rd rs rd, rd #imm rd performs a logical exclusive or operation on a general register and another general register or immediate data not b ~ rd rd obtains the one?s complement (logical complement) of general register contents notes: * size: operand size b: byte 2.5.4 shift operations table 2.7 describes the eight shift instructions. table 2.7 shift instructions instruction size * function shal shar b rd shift rd performs an arithmetic shift operation on general register contents shll shlr b rd shift rd performs a logical shift operation on general register contents rotl rotr b rd rotate rd rotates general register contents rotxl rotxr b rd rotate rd rotates general register contents through the c (carry) bit notes: * size: operand size b: byte
section 2 cpu rev. 6.00 sep 12, 2006 page 35 of 526 rej09b0326-0600 figure 2.6 shows the instruction code format of arithmetic, logic, and shift instructions. 15 0 87 op rm rn add, sub, cmp, addx, subx (rm) legend: op: rm, rn: imm: operation field register field immediate data 15 0 87 op rn adds, subs, inc, dec, daa, das, neg, not 15 0 87 op rn mulxu, divxu rm 15 0 87 rn imm add, addx, subx, cmp (#xx:8) op 15 0 87 op rn and, or, xor (rm) rm 15 0 87 rn imm and, or, xor (#xx:8) op 15 0 87 rn shal, shar, shll, shlr, rotl, rotr, rotxl, rotxr op figure 2.6 arithmetic, logic, and shift instruction codes
section 2 cpu rev. 6.00 sep 12, 2006 page 36 of 526 rej09b0326-0600 2.5.5 bit manipulations table 2.8 describes the bit-manipulation instructions. figure 2.7 shows their object code formats. table 2.8 bit-manipulation instructions instruction size * function bset b 1 ( of ) sets a specified bit in a general register or memory to 1. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bclr b 0 ( of ) clears a specified bit in a general register or memory to 0. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bnot b ~ ( of ) ( of ) inverts a specified bit in a general register or memory. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. btst b ~ ( of ) z tests a specified bit in a general register or memory and sets or clears the z flag accordingly. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. band b c ( of ) c ands the c flag with a specified bit in a general register or memory, and stores the result in the c flag. biand b c [~ ( of )] c ands the c flag with the inverse of a specified bit in a general register or memory, and stores the result in the c flag. the bit number is specified by 3-bit immediate data. bor b c ( of ) c ors the c flag with a specified bit in a general register or memory, and stores the result in the c flag. bior b c [~ ( of )] c ors the c flag with the inverse of a specified bit in a general register or memory, and stores the result in the c flag. the bit number is specified by 3-bit immediate data. notes: * size: operand size b: byte
section 2 cpu rev. 6.00 sep 12, 2006 page 37 of 526 rej09b0326-0600 instruction size * function bxor b c ( of ) c xors the c flag with a specified bit in a general register or memory, and stores the result in the c flag. bixor b c [~( of )] c xors the c flag with the inverse of a specified bit in a general register or memory, and stores the result in the c flag. the bit number is specified by 3-bit immediate data. bld b ( of ) c copies a specified bit in a general register or memory to the c flag. bild b ~ ( of ) c copies the inverse of a specified bit in a general register or memory to the c flag. the bit number is specified by 3-bit immediate data. bst b c ( of ) copies the c flag to a specified bit in a general register or memory. bist b ~ c ( of ) copies the inverse of the c flag to a specified bit in a general register or memory. the bit number is specified by 3-bit immediate data. notes: * size: operand size b: byte certain precautions are required in bit manipulation. see section 2.9.2, notes on bit manipulation, for details.
section 2 cpu rev. 6.00 sep 12, 2006 page 38 of 526 rej09b0326-0600 15 0 87 op imm rn operand: bit no.: legend: op: rm, rn: abs: imm: operation field register field absolute address immediate data 15 0 87 op rn bset, bclr, bnot, btst register direct (rn) immediate (#xx:3) operand: bit no.: register direct (rn) register direct (rm) rm 15 0 87 op 0 operand: bit no.: register indirect (@rn) immediate (#xx:3) rn 0 0 0 0 0 0 0 imm 15 0 87 op 0 operand: bit no.: register indirect (@rn) register direct (rm) rn 0 0 0 0 0 0 0 rm op 15 0 87 op operand: bit no.: absolute (@aa:8) immediate (#xx:3) abs 0000 imm op op 15 0 87 op operand: bit no.: absolute (@aa:8) register direct (rm) abs 0000 rm op 15 0 87 op imm rn operand: bit no.: register direct (rn) immediate (#xx:3) band, bor, bxor, bld, bst 15 0 87 op 0 operand: bit no.: register indirect (@rn) immediate (#xx:3) rn 0 0 0 0 0 0 0 imm op 15 0 87 op operand: bit no.: absolute (@aa:8) immediate (#xx:3) abs 0000 imm op figure 2.7 bit manipulation instruction codes
section 2 cpu rev. 6.00 sep 12, 2006 page 39 of 526 rej09b0326-0600 legend: op: rm, rn: abs: imm: operation field register field absolute address immediate data 15 0 87 op imm rn operand: bit no.: register direct (rn) immediate (#xx:3) biand, bior, bixor, bild, bist 15 0 87 op 0 operand: bit no.: register indirect (@rn) immediate (#xx:3) rn 0 0 0 0 0 0 0 imm op 15 0 87 op operand: bit no.: absolute (@aa:8) immediate (#xx:3) abs 0000 imm op figure 2.7 bit manipulation instruction codes (cont)
section 2 cpu rev. 6.00 sep 12, 2006 page 40 of 526 rej09b0326-0600 2.5.6 branching instructions table 2.9 describes the branching instructions. figure 2.8 shows their object code formats. table 2.9 branching instructions instruction size * function bcc ? branches to the designated address if condition cc is true. the branching conditions are given below. mnemonic description condition bra (bt) always (true) always brn (bf) never (false) never bhi high c z = 0 bls low or same c z = 1 bcc (bhs) carry clear (high or same) c = 0 bcs (blo) carry set (low) c = 1 bne not equal z = 0 beq equal z = 1 bvc overflow clear v = 0 bvs overflow set v = 1 bpl plus n = 0 bmi minus n = 1 bge greater or equal n v = 0 blt less than n v = 1 bgt greater than z (n v) = 0 ble less or equal z (n v) = 1 jmp ? branches unconditionally to a specified address bsr ? branches to a subroutine at a specified address jsr ? branches to a subroutine at a specified address rts ? returns from a subroutine
section 2 cpu rev. 6.00 sep 12, 2006 page 41 of 526 rej09b0326-0600 legend: op: cc: rm: disp: abs: operation field condition field register field displacement absolute address 15 0 87 op cc disp bcc 15 0 87 op rm 0 jmp (@rm) 000 15 0 87 op jmp (@aa:16) abs 15 0 87 op abs jmp (@@aa:8) 15 0 87 op disp bsr 15 0 87 op rm 0 jsr (@rm) 000 15 0 87 op jsr (@aa:16) abs 15 0 87 op abs jsr (@@aa:8) 15 0 87 op rts figure 2.8 branching instruction codes
section 2 cpu rev. 6.00 sep 12, 2006 page 42 of 526 rej09b0326-0600 2.5.7 system control instructions table 2.10 describes the system control instructions. figure 2.9 shows their object code formats. table 2.10 system control instructions instruction size * function rte ? returns from an exception-handling routine sleep ? causes a transition from active mode to a power-down mode. see section 5, power-down modes, for details. ldc b rs ccr, #imm ccr moves immediate data or general register contents to the condition code register stc b ccr rd copies the condition code register to a specified general register andc b ccr #imm ccr logically ands the condition code register with immediate data orc b ccr #imm ccr logically ors the condition code register with immediate data xorc b ccr #imm ccr logically exclusive-ors the condition code register with immediate data nop ? pc + 2 pc only increments the program counter notes: * size: operand size b: byte
section 2 cpu rev. 6.00 sep 12, 2006 page 43 of 526 rej09b0326-0600 legend: op: rn: imm: operation field register field immediate data 15 0 87 op rte, sleep, nop 15 0 87 op rn ldc, stc (rn) 15 0 87 op imm andc, orc, xorc, ldc (#xx:8) figure 2.9 system control instruction codes 2.5.8 block data transfer instruction table 2.11 describes the block data transfer instruction. figure 2.10 shows its object code format. table 2.11 block data transfer instruction instruction size function eepmov ? if r4l 0 then repeat @r5+ @r6+ r4l ? 1 r4l until r4l = 0 else next; block transfer instruction. transfers the number of data bytes specified by r4l from locations starting at the address indicated by r5 to locations starting at the address indicated by r6. after the transfer, the next instruction is executed. certain precautions are required in using the eepmov instruction. see section 2.9.3, notes on use of the eepmov instruction, for details.
section 2 cpu rev. 6.00 sep 12, 2006 page 44 of 526 rej09b0326-0600 legend: op: operation field 15 0 87 op op figure 2.10 block data transfer instruction code 2.6 basic operational timing cpu operation is synchronized by a system clock ( ) or a subclock ( sub ). for details on these clock signals see section 4, clock pulse generators. the period from a rising edge of or sub to the next rising edge is called one state. a bus cycle consists of two states or three states. the cycle differs depending on whether access is to on-chip memory or to on-chip peripheral modules. 2.6.1 access to on-chip memory (ram, rom) access to on-chip memory takes place in two states. the data bus width is 16 bits, allowing access in byte or word size. figure 2.11 shows the on-chip memory access cycle. t 1 state bus cycle t 2 state internal address bus internal read signal internal data bus (read access) internal write signal read data address write data internal data bus (write access) sub or figure 2.11 on-chip memory access cycle
section 2 cpu rev. 6.00 sep 12, 2006 page 45 of 526 rej09b0326-0600 2.6.2 access to on-chip peripheral modules on-chip peripheral modules are accessed in two states or three states. the data bus width is 8 bits, so access is by byte size only. this means that for accessing word data, two instructions must be used. two-state access to on-chip peripheral modules: figure 2.12 shows the operation timing in the case of two-state access to an on-chip peripheral module. t 1 state bus cycle t 2 state or internal address bus internal read signal internal data bus (read access) internal write signal read data address write data internal data bus (write access) sub figure 2.12 on-chip peripheral module access cycle (2-state access)
section 2 cpu rev. 6.00 sep 12, 2006 page 46 of 526 rej09b0326-0600 three-state access to on-chip peripheral modules: figure 2.13 shows the operation timing in the case of three-state access to an on-chip peripheral module. t 1 state bus cycle internal address bus internal read signal internal data bus (read access) internal write signal read data address internal data bus (write access) t 2 state t 3 state write data sub or figure 2.13 on-chip peripheral module access cycle (3-state access) 2.7 cpu states 2.7.1 overview there are four cpu states: the reset state, program execution state, program halt state, and exception-handling state. the program execution state includes active (high-speed or medium- speed) mode and subactive mode. in the program halt state there are a sleep (high-speed or medium-speed) mode, standby mode, watch mode, and sub-sleep mode. these states are shown in figure 2.14. figure 2.15 shows the state transitions.
section 2 cpu rev. 6.00 sep 12, 2006 page 47 of 526 rej09b0326-0600 cpu state reset state program execution state program halt state exception- handling state active (high speed) mode active (medium speed) mode subactive mode sleep (high-speed) mode standby mode watch mode subsleep mode low-power modes the cpu executes successive program instructions at high speed, synchronized by the system clock the cpu executes successive program instructions at reduced speed, synchronized by the system clock the cpu executes successive program instructions at reduced speed, synchronized by the subclock a state in which some or all of the chip functions are stopped to conserve power a transient state in which the cpu changes the processing flow due to a reset or an interrupt the cpu is initialized note: see section 5, power-down modes, for details on the modes and their transitions. sleep (medium-speed) mode figure 2.14 cpu operation states
section 2 cpu rev. 6.00 sep 12, 2006 page 48 of 526 rej09b0326-0600 reset state program halt state exception-handling state program execution state reset cleared sleep instruction executed reset occurs interrupt source reset occurs exception- handling request exception- handling complete reset occurs figure 2.15 state transitions 2.7.2 program execution state in the program execution state the cpu executes program instructions in sequence. there are three modes in this state, two active modes (high speed and medium speed) and one subactive mode. operation is synchronized with the system clock in active mode (high speed and medium speed), and with the subclock in subactive mode. see section 5, power-down modes for details on these modes. 2.7.3 program halt state in the program halt state there are five modes: two sleep modes (high speed and medium speed), standby mode, watch mode, and subsleep mode. see section 5, power-down modes for details on these modes. 2.7.4 exception-handling state the exception-handling state is a transient state occurring when exception handling is started by a reset or interrupt and the cpu changes its normal processing flow. in exception handling caused by an interrupt, sp (r7) is referenced and the pc and ccr values are saved on the stack. for details on interrupt handling, see section 3.3, interrupts.
section 2 cpu rev. 6.00 sep 12, 2006 page 49 of 526 rej09b0326-0600 2.8 memory map figure 2.16 shows a memory map of the h8/3644 group. interrupt vectors on-chip rom reserved reserved on-chip ram reserved internal i/o registers (16 bytes) internal i/o registers (128 bytes) h'0000 h'002f h'0030 h'1fff h'3fff h'5fff h'7fff h'f770 h'f77f h'fb80 h'ff9f h'ffa0 h'ffff h'2fff 8 kbytes h8/3640 h'ff7f h'ff80 h'ff7f h'ff80 12 kbytes h8/3641 12 kbytes h8/3642 24 kbytes h8/3643 32 kbytes h8/3644 512 bytes 512 bytes 512 bytes 1 kbyte 1 kbyte figure 2.16 h8/3644 group memory map
section 2 cpu rev. 6.00 sep 12, 2006 page 50 of 526 rej09b0326-0600 2.9 application notes 2.9.1 notes on data access 1. access to empty areas the address space of the h8/300l cpu includes empty areas in addition to the ram, registers, and rom areas available to the user. if these empty areas are mistakenly accessed by an application program, the following results will occur. data transfer from cpu to empty area: the transferred data will be lost. this action may also cause the cpu to misoperate. data transfer from empty area to cpu: unpredictable data is transferred. 2. access to internal i/o registers internal data transfer to or from on-chip modules other than the rom and ram areas makes use of an 8-bit data width. if word access is attempted to these areas, the following results will occur. word access from cpu to i/o register area: upper byte: will be written to i/o register. lower byte: transferred data will be lost. word access from i/o register to cpu: upper byte: will be written to upper part of cpu register. lower byte: unpredictable data will be written to lower part of cpu register. byte size instructions should therefore be used when transferring data to or from i/o registers other than the on-chip rom and ram areas. figure 2.17 shows the data size and number of states in which on-chip peripheral modules can be accessed.
section 2 cpu rev. 6.00 sep 12, 2006 page 51 of 526 rej09b0326-0600 interrupt vector area (48 bytes) on-chip rom on-chip ram internal i/o registers (96 bytes) internal i/o registers (16 bytes) reserved 1,024 bytes h'0000 h'002f h'0030 h'7fff h'f770 h'f77f h'fb80 h'ff7f h'ff80 h'ff9f h'ffa0 h'ffff word byte access states 2 or 3 * 2 ??? ?? 3 * 2 ??? ? reserved reserved notes: the h8/3644 is shown as an example. * internal i/o registers in areas assigned to timer x (h'f770 to h'f77f), sci3 (h'ffa8 to h'ffad), and timer v (h'ffb8 to h'ffbd) are accessed in three states. figure 2.17 data size and number of states for access to and from on-chip peripheral modules
section 2 cpu rev. 6.00 sep 12, 2006 page 52 of 526 rej09b0326-0600 2.9.2 notes on bit manipulation the bset, bclr, bnot, bst, and bist instructions read one byte of data, modify the data, then write the data byte again. special care is required when using these instructions in cases where two registers are assigned to the same address, in the case of registers that include write- only bits, and when the instruction accesses an i/o port. order of operation operation 1 read read byte data at the designated address 2 modify modify a designated bit in the read data 3 write write the altered byte data to the designated address bit manipulation in two registers assigned to the same address example 1: timer load register and timer counter figure 2.18 shows an example in which two timer registers share the same address. when a bit manipulation instruction accesses the timer load register and timer counter of a reloadable timer, since these two registers share the same address, the following operations take place. order of operation operation 1 read timer counter data is read (one byte) 2 modify the cpu modifies (sets or resets) the bit designated in the instruction 3 write the altered byte data is written to the timer load register the timer counter is counting, so the value read is not necessarily the same as the value in the timer load register. as a result, bits other than the intended bit in the timer load register may be modified to the timer counter value. r w r: w: read write count clock timer counter timer load register reload internal bus figure 2.18 timer configuration example
section 2 cpu rev. 6.00 sep 12, 2006 page 53 of 526 rej09b0326-0600 example 2: bset instruction executed designating port 3 p3 7 and p3 6 are designated as input pins, with a low-level signal input at p3 7 and a high-level signal at p3 6 . the remaining pins, p3 5 to p3 0 , are output pins and output low-level signals. in this example, the bset instruction is used to change pin p3 0 to high-level output. [a: prior to executing bset] p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output input input output output output output output output pin state low level high level low level low level low level low level low level low level pcr3 0 0 1 1 1 1 1 1 pdr3 1 0 0 0 0 0 0 0 [b: bset instruction executed] bset #0 , @pdr3 the bset instruction is executed designating port 3. [c: after executing bset] p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output input input output output output output output output pin state low level high level low level low level low level low level low level high level pcr3 0 0 1 1 1 1 1 1 pdr3 0 1 0 0 0 0 0 1 [d: explanation of how bset operates] when the bset instruction is executed, first the cpu reads port 3. since p3 7 and p3 6 are input pins, the cpu reads the pin states (low-level and high-level input). p3 5 to p3 0 are output pins, so the cpu reads the value in pdr3. in this example pdr3 has a value of h'80, but the value read by the cpu is h'40. next, the cpu sets bit 0 of the read data to 1, changing the pdr3 data to h'41. finally, the cpu writes this value (h'41) to pdr3, completing execution of bset.
section 2 cpu rev. 6.00 sep 12, 2006 page 54 of 526 rej09b0326-0600 as a result of this operation, bit 0 in pdr3 becomes 1, and p3 0 outputs a high-level signal. however, bits 7 and 6 of pdr3 end up with different values. to avoid this problem, store a copy of the pdr3 data in a work area in memory. perform the bit manipulation on the data in the work area, then write this data to pdr3. [a: prior to executing bset] mov. b #80, r0l mov. b r0l, @ram0 mov. b r0l, @pdr3 the pdr3 value (h'80) is written to a work area in memory (ram0) as well as to pdr3. p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output input input output output output output output output pin state low level high level low level low level low level low level low level low level pcr3 0 0 1 1 1 1 1 1 pdr3 1 0 0 0 0 0 0 0 ram0 1 0 0 0 0 0 0 0 [b: bset instruction executed] bset #0 , @ram0 the bset instruction is executed designating the pdr3 work area (ram0). [c: after executing bset] mov. b @ram0, r0l mov. b r0l, @pdr3 the work area (ram0) value is written to pdr3. p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output input input output output output output output output pin state low level high level low level low level low level low level low level high level pcr3 0 0 1 1 1 1 1 1 pdr3 1 0 0 0 0 0 0 1 ram0 1 0 0 0 0 0 0 1
section 2 cpu rev. 6.00 sep 12, 2006 page 55 of 526 rej09b0326-0600 bit manipulation in a register containing a write-only bit example 3: bclr instruction executed designating port 3 control register pcr3 as in the examples above, p3 7 and p3 6 are input pins, with a low-level signal input at p3 7 and a high-level signal at p3 6 . the remaining pins, p3 5 to p3 0 , are output pins that output low-level signals. in this example, the bclr instruction is used to change pin p3 0 to an input port. it is assumed that a high-level signal will be input to this input pin. [a: prior to executing bclr] p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output input input output output output output output output pin state low level high level low level low level low level low level low level low level pcr3 0 0 1 1 1 1 1 1 pdr3 1 0 0 0 0 0 0 0 [b: bclr instruction executed] bclr #0 , @pcr3 the bclr instruction is executed designating pcr3. [c: after executing bclr] p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output output output output output output output output input pin state low level high level low level low level low level low level low level high level pcr3 1 1 1 1 1 1 1 0 pdr3 1 0 0 0 0 0 0 0 [d: explanation of how bclr operates] when the bclr instruction is executed, first the cpu reads pcr3. since pcr3 is a write-only register, the cpu reads a value of h'ff, even though the pcr3 value is actually h'3f. next, the cpu clears bit 0 in the read data to 0, changing the data to h'fe. finally, this value (h'fe) is written to pcr3 and bclr instruction execution ends.
section 2 cpu rev. 6.00 sep 12, 2006 page 56 of 526 rej09b0326-0600 as a result of this operation, bit 0 in pcr3 becomes 0, making p3 0 an input port. however, bits 7 and 6 in pcr3 change to 1, so that p3 7 and p3 6 change from input pins to output pins. to avoid this problem, store a copy of the pcr3 data in a work area in memory. perform the bit manipulation on the data in the work area, then write this data to pcr3. [a: prior to executing bclr] mov. b #3f, r0l mov. b r0l, @ram0 mov. b r0l, @pcr3 the pcr3 value (h'3f) is written to a work area in memory (ram0) as well as to pcr3. p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output input input output output output output output output pin state low level high level low level low level low level low level low level low level pcr3 0 0 1 1 1 1 1 1 pdr3 1 0 0 0 0 0 0 0 ram0 0 0 1 1 1 1 1 1 [b: bclr instruction executed] bclr #0 , @ram0 the bclr instruction is executed designating the pcr3 work area (ram0). [c: after executing bclr] mov. b @ram0, r0l mov. b r0l, @pcr3 the work area (ram0) value is written to pcr3. p3 7 p3 6 p3 5 p3 4 p3 3 p3 2 p3 1 p3 0 input/output input input output output output output output output pin state low level high level low level low level low level low level low level high level pcr3 0 0 1 1 1 1 1 0 pdr3 1 0 0 0 0 0 0 0 ram0 0 0 1 1 1 1 1 0
section 2 cpu rev. 6.00 sep 12, 2006 page 57 of 526 rej09b0326-0600 table 2.12 lists the pairs of registers that share identical addresses. table 2.13 lists the registers that contain write-only bits. table 2.12 registers with shared addresses register name abbreviation address output compare register ah and output compare register bh (timer x) ocrah/ocrbh h'f774 output compare register al and output compare register bl (timer x) ocral/ocrbl h'f775 timer counter b1 and timer load register b1 (timer b1) tcb1/tlb1 h'ffb3 port data register 1 * pdr1 h'ffd4 port data register 2 * pdr2 h'ffd5 port data register 3 * pdr3 h'ffd6 port data register 5 * pdr5 h'ffd8 port data register 6 * pdr6 h'ffd9 port data register 7 * pdr7 h'ffda port data register 8 * pdr8 h'ffdb port data register 9 * pdr9 h'ffdc note: * port data registers have the same addresses as input pins. table 2.13 registers with write-only bits register name abbreviation address port control register 1 pcr1 h'ffe4 port control register 2 pcr2 h'ffe5 port control register 3 pcr3 h'ffe6 port control register 5 pcr5 h'ffe8 port control register 6 pcr6 h'ffe9 port control register 7 pcr7 h'ffea port control register 8 pcr8 h'ffeb port control register 9 pcr9 h'ffec pwm control register pwcr h'ffd0 pwm data register u pwdru h'ffd1 pwm data register l pwdrl h'ffd2
section 2 cpu rev. 6.00 sep 12, 2006 page 58 of 526 rej09b0326-0600 2.9.3 notes on use of the eepmov instruction ? the eepmov instruction is a block data transfer instruction. it moves the number of bytes specified by r4l from the address specified by r5 to the address specified by r6. r6 r6 + r4l r5 r5 + r4l ? when setting r4l and r6, make sure that the final destination address (r6 + r4l) does not exceed h'ffff. the value in r6 must not change from h'ffff to h'0000 during execution of the instruction. h'ffff not allowed r6 r6 + r4l r5 r5 + r4l
section 3 exception handling rev. 6.00 sep 12, 2006 page 59 of 526 rej09b0326-0600 section 3 exception handling 3.1 overview exception handling is performed in the h8/3644 group when a reset or interrupt occurs. table 3.1 shows the priorities of these two types of exception handling. table 3.1 exception handling types and priorities priority exception source time of start of exception handling high reset exception handling starts as soon as the reset state is cleared low interrupt when an interrupt is requested, exception handling starts after execution of the present instruction or the exception handling in progress is completed 3.2 reset 3.2.1 overview a reset is the highest-priority exception. the internal state of the cpu and the registers of the on- chip peripheral modules are initialized. 3.2.2 reset sequence reset by res res res res pin: as soon as the res pin goes low, all processing is stopped and the chip enters the reset state. to make sure the chip is reset properly, observe the following precautions. ? at power on: hold the res pin low until the clock pulse generator output stabilizes. ? resetting during operation: hold the res pin low for at least 10 system clock cycles. reset exception handling begins when the res pin is held low for a given period, then returned to the high level.
section 3 exception handling rev. 6.00 sep 12, 2006 page 60 of 526 rej09b0326-0600 reset exception handling takes place as follows. ? the cpu internal state and the registers of on-chip peripheral modules are initialized, with the i bit of the condition code register (ccr) set to 1. ? the pc is loaded from the reset exception handling vector address (h'0000 to h'0001), after which the program starts executing from the address indicated in pc. when system power is turned on or off, the res pin should be held low. figure 3.1 shows the reset sequence starting from res input. vector fetch internal address bus internal read signal internal write signal internal data bus (16-bit) res internal processing program initial instruction prefetch (1) reset exception handling vector address (h'0000) (2) program start address (3) first instruction of program (2) (3) (2) (1) reset cleared figure 3.1 reset sequence
section 3 exception handling rev. 6.00 sep 12, 2006 page 61 of 526 rej09b0326-0600 reset by watchdog timer: the watchdog timer counter (tcw) starts counting up when the wdon bit is set to 1 in the watchdog timer control/status register (tcsrw). if tcw overflows, the wrst bit is set to 1 in tcsrw and the chip enters the reset state. while the wrst bit is set to 1 in tcsrw, when tcw overflows the reset state is cleared and reset exception handling begins. the same reset exception handling is carried out as for input at the res pin. for details on the watchdog timer, see section 9.6, watchdog timer. 3.2.3 interrupt immediately after reset after a reset, if an interrupt were to be accepted before the stack pointer (sp: r7) was initialized, pc and ccr would not be pushed onto the stack correctly, resulting in program runaway. to prevent this, immediately after reset exception handling all interrupts are masked. for this reason, the initial program instruction is always executed immediately after a reset. this instruction should initialize the stack pointer (e.g. mov.w #xx: 16, sp). 3.3 interrupts 3.3.1 overview the interrupt sources include 12 external interrupts (irq 3 to irq 0 , int 7 to int 0 ) and 21 internal interrupts from on-chip peripheral modules. table 3.2 shows the interrupt sources, their priorities, and their vector addresses. when more than one interrupt is requested, the interrupt with the highest priority is processed. the interrupts have the following features: ? internal and external interrupts can be masked by the i bit in ccr. when the i bit is set to 1, interrupt request flags can be set but the interrupts are not accepted. ? irq 3 to irq 0 and int 7 to int 0 can be set independently to either rising edge sensing or falling edge sensing.
section 3 exception handling rev. 6.00 sep 12, 2006 page 62 of 526 rej09b0326-0600 table 3.2 interrupt sources and their priorities interrupt source interrupt vector number vector address priority res reset 0 h'0000 to h'0001 high irq 0 irq 0 4 h'0008 to h'0009 irq 1 irq 1 5 h'000a to h'000b irq 2 irq 2 6 h'000c to h'000d irq 3 irq 3 7 h'000e to h'000f int 0 int 0 8 h'0010 to h'0011 int 1 int 1 int 2 int 2 int 3 int 3 int 4 int 4 int 5 int 5 int 6 int 6 int 7 int 7 timer a timer a overflow 10 h'0014 to h'0015 timer b1 timer b1 overflow 11 h'0016 to h'0017 timer x timer x input capture a 16 h'0020 to h'0021 timer x input capture b timer x input capture c timer x input capture d timer x compare match a timer x compare match b timer x overflow timer v timer v compare match a 17 h'0022 to h'0023 timer v compare match b timer v overflow sci1 sci1 transfer complete 19 h'0026 to h'0027 sci3 sci3 transmit end 21 h'002a to h'002b sci3 transmit data empty sci3 receive data full sci3 overrun error sci3 framing error sci3 parity error a/d a/d conversion end 22 h'002c to h'002d (sleep instruction executed) direct transfer 23 h'002e to h'002f low note: vector addresses h'0002 to h'0007, h'0012 to h'0013, h'0018 to h'001f, h'0024 to h'0025, h'0028 to h'0029 are reserved and cannot be used.
section 3 exception handling rev. 6.00 sep 12, 2006 page 63 of 526 rej09b0326-0600 3.3.2 interrupt control registers table 3.3 lists the registers that control interrupts. table 3.3 interrupt control registers name abbreviation r/w initial value address interrupt edge select register 1 iegr1 r/w h'70 h'fff2 interrupt edge select register 2 iegr2 r/w h'00 h'fff3 interrupt enable register 1 ienr1 r/w h'10 h'fff4 interrupt enable register 2 ienr2 r/w h'00 h'fff5 interrupt enable register 3 ienr3 r/w h'00 h'fff6 interrupt request register 1 irr1 r/w * h'10 h'fff7 interrupt request register 2 irr2 r/w * h'00 h'fff8 interrupt request register 3 irr3 r/w * h'00 h'fff9 note: * write is enabled only for writing of 0 to clear a flag. interrupt edge select register 1 (iegr1) bit 7 6 5 4 3 2 1 0 ? ? ? ? ieg3 ieg2 ieg1 ieg0 initial value 0 1 1 1 0 0 0 0 read/write ? ? ? ? r/w r/w r/w r/w iegr1 is an 8-bit read/write register used to designate whether pins irq 3 to irq 0 are set to rising edge sensing or falling edge sensing. upon reset, iegr1 is initialized to h'70. bit 7 ? ? ? ? reserved bit: bit 7 is reserved: it is always read as 0 and cannot be modified. bits 6 to 4 ? ? ? ? reserved bits: bits 6 to 4 are reserved; they are always read as 1, and cannot be modified. bit 3 ? ? ? ? irq 3 edge select (ieg3): bit 3 selects the input sensing of pin irq 3 . bit 3: ieg3 description 0 falling edge of irq 3 pin input is detected (initial value) 1 rising edge of irq 3 pin input is detected
section 3 exception handling rev. 6.00 sep 12, 2006 page 64 of 526 rej09b0326-0600 bit 2 ? irq 2 edge select (ieg2): bit 2 selects the input sensing of pin irq 2 . bit 2: ieg2 description 0 falling edge of irq 2 pin input is detected (initial value) 1 rising edge of irq 2 pin input is detected bit 1 ? ? ? ? irq 1 edge select (ieg1): bit 1 selects the input sensing of pin irq 1 . bit 1: ieg1 description 0 falling edge of irq 1 pin input is detected (initial value) 1 rising edge of irq 1 pin input is detected bit 0 ? ? ? ? irq 0 edge select (ieg0): bit 0 selects the input sensing of pin irq 0 . bit 0: ieg0 description 0 falling edge of irq 0 pin input is detected (initial value) 1 rising edge of irq 0 pin input is detected interrupt edge select register 2 (iegr2) bit 7 6 5 4 3 2 1 0 integ7 integ6 integ5 integ4 integ3 integ2 integ1 integ0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w iegr2 is an 8-bit read/write register, used to designate whether pins int 7 to int 0 , and tmib are set to rising edge sensing or falling edge sensing. upon reset, iegr2 is initialized to h'00. bit 7 ? ? ? ? int 7 edge select (integ7): bit 7 selects the input sensing of the int 7 pin. bit 7: integ7 description 0 falling edge of int 7 pin input is detected (initial value) 1 rising edge of int 7 pin input is detected
section 3 exception handling rev. 6.00 sep 12, 2006 page 65 of 526 rej09b0326-0600 bit 6 ? ? ? ? int 6 edge select (integ6): bit 6 selects the input sensing of the int 6 pin and tmib pin. bit 6: integ6 description 0 falling edge of int 6 and tmib pin input is detected (initial value) 1 rising edge of int 6 and tmib pin input is detected bit 5 ? ? ? ? int 5 edge select (integ5): bit 5 selects the input sensing of the int 5 pin and adtrg pin. bit 5: integ5 description 0 falling edge of int 5 and adtrg pin input is detected (initial value) 1 rising edge of int 5 and adtrg pin input is detected bits 4 to 0 ? ? ? ? int 4 to int 0 edge select (integ4 to integ0): bits 4 to 0 select the input sensing of pins int 4 to int 0 . bit n: integn description 0 falling edge of int n pin input is detected (initial value) 1 rising edge of int n pin input is detected (n = 4 to 0) interrupt enable register 1 (ienr1) bit 7 6 5 4 3 2 1 0 ientb1 ienta ? ? ien3 ien2 ien1 ien0 initial value 0 0 0 1 0 0 0 0 read/write r/w r/w ? ? r/w r/w r/w r/w ienr1 is an 8-bit read/write register that enables or disables interrupt requests. upon reset, ienr1 is initialized to h'10. bit 7 ? ? ? ? timer b1 interrupt enable (ientb1): bit 7 enables or disables timer b1 overflow interrupt requests. bit 7: ientb1 description 0 disables timer b1 interrupt requests (initial value) 1 enables timer b1 interrupt requests
section 3 exception handling rev. 6.00 sep 12, 2006 page 66 of 526 rej09b0326-0600 bit 6 ? ? ? ? timer a interrupt enable (ienta): bit 6 enables or disables timer a overflow interrupt requests. bit 6: ienta description 0 disables timer a interrupt requests (initial value) 1 enables timer a interrupt requests bit 5 ? ? ? ? reserved bit: bit 5 is reserved: it is always read as 0 and cannot be modified. bit 4 ? ? ? ? reserved bit: bit 4 is reserved; it is always read as 1, and cannot be modified. bits 3 to 0 ? ? ? ? irq 3 to irq 0 interrupt enable (ien3 to ien0): bits 3 to 0 enable or disable irq 3 to irq 0 interrupt requests. bit n: ienn description 0 disables interrupt requests from pin irq n (initial value) 1 enables interrupt requests from pin irq n (n = 3 to 0) interrupt enable register 2 (ienr2) bit 7 6 5 4 3 2 1 0 iendt ienad ? iens1 ? ? ? ? initial value 0 0 0 0 0 0 0 0 read/write r/w r/w ? r/w ? ? ? ? ienr2 is an 8-bit read/write register that enables or disables interrupt requests. upon reset, ienr2 is initialized to h'00. bit 7 ? ? ? ? direct transfer interrupt enable (iendt): bit 7 enables or disables direct transfer interrupt requests. bit 7: iendt description 0 disables direct transfer interrupt requests (initial value) 1 enables direct transfer interrupt requests
section 3 exception handling rev. 6.00 sep 12, 2006 page 67 of 526 rej09b0326-0600 bit 6 ? ? ? ? a/d converter interrupt enable (ienad): bit 6 enables or disables a/d converter interrupt requests. bit 6: ienad description 0 disables a/d converter interrupt requests (initial value) 1 enables a/d converter interrupt requests bit 5 ? ? ? ? reserved bit: bit 5 is reserved: it is always read as 0 and cannot be modified. bit 4 ? ? ? ? sci1 interrupt enable (iens1): bit 4 enables or disables sci1 transfer complete interrupt requests. bit 4: iens1 description 0 disables sci1 interrupt requests (initial value) 1 enables sci1 interrupt requests bits 3 to 0 ? ? ? ? reserved bits: bits 3 to 0 are reserved: they are always read as 0 and cannot be modified. interrupt enable register 3 (ienr3) bit 7 6 5 4 3 2 1 0 inten7 inten6 inten5 inten4 inten3 inten2 inten1 inten0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w ienr3 is an 8-bit read/write register that enables or disables int 7 to int 0 interrupt requests. upon reset, ienr3 is initialized to h'00. bits 7 to 0 ? ? ? ? int 7 to int 0 interrupt enable (inten7 to inten0): bits 7 to 0 enable or disable int 7 to int 0 interrupt requests. bit n: intenn description 0 disables interrupt requests from pin int n (initial value) 1 enables interrupt requests from pin int n (n = 7 to 0)
section 3 exception handling rev. 6.00 sep 12, 2006 page 68 of 526 rej09b0326-0600 interrupt request register 1 (irr1) bit 7 6 5 4 3 2 1 0 irrtb1 irrta ? ? irri3 irri2 irri1 irri0 initial value 0 0 0 1 0 0 0 0 read/write r/w * r/w * ? ? r/w * r/w * r/w * r/w * note: * only a write of 0 for flag clearing is possible. irr1 is an 8-bit read/write register, in which a corresponding flag is set to 1 when a timer b1, timer a, or irq 3 to irq 0 interrupt is requested. the flags are not cleared automatically when an interrupt is accepted. it is necessary to write 0 to clear each flag. upon reset, irr1 is initialized to h'10. bit 7 ? ? ? ? timer b1 interrupt request flag (irrtb1) bit 7: irrtb1 description 0 clearing condition: (initial value) when irrtb1 = 1, it is cleared by writing 0 1 setting condition: when the timer b1 counter value overflows from h'ff to h'00 bit 6 ? ? ? ? timer a interrupt request flag (irrta) bit 6: irrta description 0 clearing condition: (initial value) when irrta = 1, it is cleared by writing 0 1 setting condition: when the timer a counter value overflows from h'ff to h'00 bit 5 ? ? ? ? reserved bit: bit 5 is reserved: it is always read as 0 and cannot be modified. bit 4 ? ? ? ? reserved bit: bit 4 is reserved; it is always read as 1, and cannot be modified.
section 3 exception handling rev. 6.00 sep 12, 2006 page 69 of 526 rej09b0326-0600 bits 3 to 0 ? ? ? ? irq 3 to irq 0 interrupt request flags (irri3 to irri0) bit n: irrin description 0 clearing condition: (initial value) when irrin = 1, it is cleared by writing 0 1 setting condition: when pin irq n is designated for interrupt input and the designated signal edge is input (n = 3 to 0) interrupt request register 2 (irr2) bit 7 6 5 4 3 2 1 0 irrdt irrad ? irrs1 ? ? ? ? initial value 0 0 0 0 0 0 0 0 read/write r/w * r/w * ? r/w * ? ? ? ? note: * only a write of 0 for flag clearing is possible. irr2 is an 8-bit read/write register, in which a corresponding flag is set to 1 when a direct transfer, a/d converter, or sci1 interrupt is requested. the flags are not cleared automatically when an interrupt is accepted. it is necessary to write 0 to clear each flag. upon reset, irr2 is initialized to h'00. bit 7 ? direct transfer interrupt request flag (irrdt) bit 7: irrdt description 0 clearing condition: (initial value) when irrdt = 1, it is cleared by writing 0 1 setting condition: when a direct transfer is made by executing a sleep instruction while dton = 1 in syscr2 bit 6 ? a/d converter interrupt request flag (irrad) bit 6: irrad description 0 clearing condition: (initial value) when irrad = 1, it is cleared by writing 0 1 setting condition: when a/d conversion is completed and adsf is cleared to 0 in adsr
section 3 exception handling rev. 6.00 sep 12, 2006 page 70 of 526 rej09b0326-0600 bit 5 ? reserved bit: bit 5 is reserved: it is always read as 0 and cannot be modified. bit 4 ? sci1 interrupt request flag (irrs1) bit 4: irrs1 description 0 clearing condition: (initial value) when irrs1 = 1, it is cleared by writing 0 1 setting condition: when an sci1 transfer is completed bits 3 to 0 ? reserved bits: bits 3 to 0 are reserved: they are always read as 0 and cannot be modified. interrupt request register 3 (irr3) bit 7 6 5 4 3 2 1 0 intf7 intf6 intf5 intf4 intf3 intf2 intf1 intf0 initial value 0 0 0 0 0 0 0 0 read/write r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * note: * only a write of 0 for flag clearing is possible. irr3 is an 8-bit read/write register, in which a corresponding flag is set to 1 by a transition at pin int 7 to int 0 . the flags are not cleared automatically when an interrupt is accepted. it is necessary to write 0 to clear each flag. upon reset, irr3 is initialized to h'00. bits 7 to 0 ? int 7 to int 0 interrupt request flags (intf7 to intf0) bit n: intfn description 0 clearing condition: (initial value) when intfn = 1, it is cleared by writing 0 1 setting condition: when the designated signal edge is input at pin int n (n = 7 to 0)
section 3 exception handling rev. 6.00 sep 12, 2006 page 71 of 526 rej09b0326-0600 3.3.3 external interrupts there are 12 external interrupts: irq 3 to irq 0 and int 7 to int 0 . interrupts irq 3 to irq 0 : interrupts irq 3 to irq 0 are requested by input signals to pins irq 3 to irq 0 . these interrupts are detected by either rising edge sensing or falling edge sensing, depending on the settings of bits ieg3 to ieg0 in iegr1. when these pins are designated as pins irq 3 to irq 0 in port mode register 1 and the designated edge is input, the corresponding bit in irr1 is set to 1, requesting an interrupt. recognition of these interrupt requests can be disabled individually by clearing bits ien3 to ien0 to 0 in ienr1. these interrupts can all be masked by setting the i bit to 1 in ccr. when irq 3 to irq 0 interrupt exception handling is initiated, the i bit is set to 1 in ccr. vector numbers 7 to 4 are assigned to interrupts irq 3 to irq 0 . the order of priority is from irq 0 (high) to irq 3 (low). table 3.2 gives details. int interrupts: int interrupts are requested by input signals to pins int 7 to int 0 . these interrupts are detected by either rising edge sensing or falling edge sensing, depending on the settings of bits integ7 to integ0 in iegr2. when the designated edge is input at pins int 7 to int 0 , the corresponding bit in irr3 is set to 1, requesting an interrupt. recognition of these interrupt requests can be disabled individually by clearing bits inten7 to inten0 to 0 in ienr3. these interrupts can all be masked by setting the i bit to 1 in ccr. when int interrupt exception handling is initiated, the i bit is set to 1 in ccr. vector number 8 is assigned to the int interrupts. all eight interrupts have the same vector number, so the interrupt- handling routine must discriminate the interrupt source. note: pins int 7 to int 0 are multiplexed with port 5. even in port usage of these pins, whenever the designated edge is input or output, the corresponding bit intfn is set to 1.
section 3 exception handling rev. 6.00 sep 12, 2006 page 72 of 526 rej09b0326-0600 3.3.4 internal interrupts there are 21 internal interrupts that can be requested by the on-chip peripheral modules. when a peripheral module requests an interrupt, the corresponding bit in irr1 or irr2 is set to 1. recognition of individual interrupt requests can be disabled by clearing the corresponding bit in ienr1 or ienr2 to 0. all these interrupts can be masked by setting the i bit to 1 in ccr. when internal interrupt handling is initiated, the i bit is set to 1 in ccr. vector numbers from 23 to 9 are assigned to these interrupts. table 3.2 shows the order of priority of interrupts from on-chip peripheral modules. 3.3.5 interrupt operations interrupts are controlled by an interrupt controller. figure 3.2 shows a block diagram of the interrupt controller. figure 3.3 shows the flow up to interrupt acceptance. interrupt controller priority decision logic interrupt request ccr (cpu) i external or internal interrupts external interrupts or internal interrupt enable signals figure 3.2 block diagram of interrupt controller
section 3 exception handling rev. 6.00 sep 12, 2006 page 73 of 526 rej09b0326-0600 interrupt operation is described as follows. ? if an interrupt occurs while the interrupt enable register bit is set to 1, an interrupt request signal is sent to the interrupt controller. ? when the interrupt controller receives an interrupt request, it sets the interrupt request flag. ? from among the interrupts with interrupt request flags set to 1, the interrupt controller selects the interrupt request with the highest priority and holds the others pending. (refer to table 3.2 for a list of interrupt priorities.) ? the interrupt controller checks the i bit of ccr. if the i bit is 0, the selected interrupt request is accepted; if the i bit is 1, the interrupt request is held pending. ? if the interrupt is accepted, after processing of the current instruction is completed, both pc and ccr are pushed onto the stack. the state of the stack at this time is shown in figure 3.4. the pc value pushed onto the stack is the address of the first instruction to be executed upon return from interrupt handling. ? the i bit of ccr is set to 1, masking further interrupts. ? the vector address corresponding to the accepted interrupt is generated, and the interrupt handling routine located at the address indicated by the contents of the vector address is executed. notes: 1. when disabling interrupts by clearing bits in an interrupt enable register, or when clearing bits in an interrupt request register, always do so while interrupts are masked (i = 1). 2. if the above clear operations are performed while i = 0, and as a result a conflict arises between the clear instruction and an interrupt request, exception processing for the interrupt will be executed after the clear instruction has been executed.
section 3 exception handling rev. 6.00 sep 12, 2006 page 74 of 526 rej09b0326-0600 pc contents saved ccr contents saved i 1 i = 0 program execution state no yes yes no legend: pc: ccr: i: program counter condition code register i bit of ccr ien0 = 1 no yes iendt = 1 no yes irrdt = 1 no yes branch to interrupt handling routine irri0 = 1 no yes ien1 = 1 no yes irri1 = 1 no yes ien2 = 1 no yes irri2 = 1 figure 3.3 flow up to interrupt acceptance
section 3 exception handling rev. 6.00 sep 12, 2006 page 75 of 526 rej09b0326-0600 pc and ccr saved to stack sp (r7) sp ? 1 sp ? 2 sp ? 3 sp ? 4 stack area sp + 4 sp + 3 sp + 2 sp + 1 sp (r7) even address prior to start of interrupt exception handling after completion of interrupt exception handling legend: pc h : pc l : ccr: sp: upper 8 bits of program counter (pc) lower 8 bits of program counter (pc) condition code register stack pointer notes: ccr ccr pc h pc l 1. 2. pc shows the address of the first instruction to be executed upon return from the interrupt handling routine. register contents must always be saved and restored by word access, starting from an even-numbered address. figure 3.4 stack state after completion of interrupt exception handling figure 3.5 shows a typical interrupt sequence where the program area is in the on-chip rom and the stack area is in the on-chip ram.
section 3 exception handling rev. 6.00 sep 12, 2006 page 76 of 526 rej09b0326-0600 vector fetch ? 2 (6) sp ? 4 (7) ccr (8) vector address (9) starting address of interrupt-handling routine (contents of vector) (10) first instruction of interrupt-handling routine (3) (9) (8) (6) (5) (4) (1) (7) (10) stack access internal processing instruction prefetch interrupt level decision and wait for end of instruction interrupt is accepted figure 3.5 interrupt sequence
section 3 exception handling rev. 6.00 sep 12, 2006 page 77 of 526 rej09b0326-0600 3.3.6 interrupt response time table 3.4 shows the number of wait states after an interrupt request flag is set until the first instruction of the interrupt handler is executed. table 3.4 interrupt wait states item states waiting time for completion of executing instruction * 1 to 13 saving of pc and ccr to stack 4 vector fetch 2 instruction fetch 4 internal processing 4 total 15 to 27 note: * not including eepmov instruction.
section 3 exception handling rev. 6.00 sep 12, 2006 page 78 of 526 rej09b0326-0600 3.4 application notes 3.4.1 notes on stack area use when word data is accessed in the h8/3644 group, the least significant bit of the address is regarded as 0. access to the stack always takes place in word size, so the stack pointer (sp: r7) should never indicate an odd address. use push rn (mov.w rn, @?sp) or pop rn (mov.w @sp+, rn) to save or restore register values. setting an odd address in sp may cause a program to crash. an example is shown in figure 3.6. pc pc r1l pc sp sp sp h'fefc h'fefd h'feff ? r7 sp set to h'feff stack accessed beyond sp bsr instruction contents of pc are lost h legend: pc h : pc l : r1l: sp: upper byte of program counter lower byte of program counter general register r1l stack pointer figure 3.6 operation when odd address is set in sp when ccr contents are saved to the stack during interrupt exception handling or restored when rte is executed, this also takes place in word size. both the upper and lower bytes of word data are saved to the stack; on return, the even address contents are restored to ccr while the odd address contents are ignored.
section 3 exception handling rev. 6.00 sep 12, 2006 page 79 of 526 rej09b0326-0600 3.4.2 notes on rewriting port mode registers when a port mode register is rewritten to switch the functions of external interrupt pins, the following points should be observed. when an external interrupt pin function is switched by rewriting the port mode register that controls pins irq 3 to irq 1 , the interrupt request flag may be set to 1 at the time the pin function is switched, even if no valid interrupt is input at the pin. table 3.5 shows the conditions under which interrupt request flags are set to 1 in this way. table 3.5 conditions under which interrupt request flag is set to 1 interrupt request flags set to 1 conditions irr1 irri3 when pmr1 bit irq3 is changed from 0 to 1 while pin irq 3 is low and iegr bit ieg3 = 0. when pmr1 bit irq3 is changed from 1 to 0 while pin irq 3 is low and iegr bit ieg3 = 1. irri2 when pmr1 bit irq2 is changed from 0 to 1 while pin irq 2 is low and iegr bit ieg2 = 0. when pmr1 bit irq2 is changed from 1 to 0 while pin irq 2 is low and iegr bit ieg2 = 1. irri1 when pmr1 bit irq1 is changed from 0 to 1 while pin irq 1 is low and iegr bit ieg1 = 0. when pmr1 bit irq1 is changed from 1 to 0 while pin irq 1 is low and iegr bit ieg1 = 1. figure 3.7 shows the procedure for setting a bit in a port mode register and clearing the interrupt request flag. when switching a pin function, mask the interrupt before setting the bit in the port mode register. after accessing the port mode register, execute at least one instruction (e.g., nop), then clear the interrupt request flag from 1 to 0. if the instruction to clear the flag is executed immediately after the port mode register access without executing an intervening instruction, the flag will not be cleared. an alternative method is to avoid the setting of interrupt request flags when pin functions are switched by keeping the pins at the high level so that the conditions in table 3.5 do not occur.
section 3 exception handling rev. 6.00 sep 12, 2006 page 80 of 526 rej09b0326-0600 ccr i bit 1 set port mode register bit execute nop instruction interrupts masked. (another possibility is to disable the relevant interrupt in interrupt enable register 1.) after setting the port mode register bit, first execute at least one instruction (e.g., nop), then clear the interrupt request flag to 0 interrupt mask cleared clear interrupt request flag to 0 figure 3.7 port mode register setting and interrupt request flag clearing procedure
section 4 clock pulse generators rev. 6.00 sep 12, 2006 page 81 of 526 rej09b0326-0600 section 4 clock pulse generators 4.1 overview clock oscillator circuitry (cpg: clock pulse generator) is provided on-chip, including both a system clock pulse generator and a subclock pulse generator. the system clock pulse generator consists of a system clock oscillator and system clock dividers. the subclock pulse generator consists of a subclock oscillator circuit and a subclock divider. 4.1.1 block diagram figure 4.1 shows a block diagram of the clock pulse generators. system clock oscillator system clock divider (1/2) subclock oscillator subclock divider (1/2, 1/4, 1/8) system clock divider (1/64, 1/32, 1/16, 1/8) system clock pulse generator subclock pulse generator prescaler s (13 bits) prescaler w (5 bits) osc osc 1 2 x x 1 2 osc (f ) osc w (f ) w /2 osc /2 w /8 w sub /2 to /8192 /2 w /4 w /8 to /128 w w osc /128 osc /64 osc /32 osc /16 /4 w figure 4.1 block diagram of clock pulse generators 4.1.2 system clock and subclock the basic clock signals that drive the cpu and on-chip peripheral modules are and sub . four of the clock signals have names: is the system clock, sub is the subclock, osc is the oscillator clock, and w is the watch clock. the clock signals available for use by peripheral modules are /2, /4, /8, /16, /32, /64, /128, /256, /512, /1024, /2048, /4096, /8192, w /2, w /4, w /8, w /16, w /32, w /64, and w /128. the clock requirements differ from one module to another.
section 4 clock pulse generators rev. 6.00 sep 12, 2006 page 82 of 526 rej09b0326-0600 4.2 system clock generator clock pulses can be supplied to the system clock divider either by connecting a crystal or ceramic resonator, or by providing external clock input. connecting a crystal resonator: figure 4.2 shows a typical method of connecting a crystal resonator. 1 2 c 1 c 2 osc osc r = 1 m 20% c = c = 12 pf 20% f 12 ? r f figure 4.2 typical connection to crystal resonator figure 4.3 shows the equivalent circuit of a crystal resonator. an oscillator having the characteristics given in table 4.1 should be used. c s c 0 r s osc 1 osc 2 l s figure 4.3 equivalent circuit of crystal resonator table 4.1 crystal resonator parameters frequency 2 mhz 4 mhz 8 mhz 10 mhz r s (max) 500 ? 100 ? 50 ? 30 ? c 0 (max) 7 pf 7 pf 7 pf 7 pf
section 4 clock pulse generators rev. 6.00 sep 12, 2006 page 83 of 526 rej09b0326-0600 connecting a ceramic resonator: figure 4.4 shows a typical method of connecting a ceramic resonator. 1 2 c 1 c 2 osc osc r = 1 m 20% c = 30 pf 10% c = 30 pf 10% ceramic resonator: murata f 1 2 ? r f figure 4.4 typical connection to ceramic resonator notes on board design: when generating clock pulses by connecting a crystal or ceramic resonator, pay careful attention to the following points. avoid running signal lines close to the oscillator circuit, since the oscillator may be adversely affected by induction currents. (see figure 4.5.) the board should be designed so that the oscillator and load capacitors are located as close as possible to pins osc 1 and osc 2 . osc osc c 2 c 1 signal a signal b 2 1 to be avoided figure 4.5 board design of oscillator circuit
section 4 clock pulse generators rev. 6.00 sep 12, 2006 page 84 of 526 rej09b0326-0600 external clock input method: connect an external clock signal to pin osc 1 , and leave pin osc 2 open. figure 4.6 shows a typical connection. 1 2 osc osc external clock input open figure 4.6 external clock input (example) frequency oscillator clock ( osc ) duty cycle 45% to 55% 4.3 subclock generator connecting a 32.768-khz crystal resonator: clock pulses can be supplied to the subclock divider by connecting a 32.768-khz crystal resonator, as shown in figure 4.7. follow the same precautions as noted under section 4.2, notes on board design. x x c 1 c 2 1 2 c = c = 15 pf (typ.) 12 figure 4.7 typical connection to 32.768-khz crystal resonator
section 4 clock pulse generators rev. 6.00 sep 12, 2006 page 85 of 526 rej09b0326-0600 figure 4.8 shows the equivalent circuit of the 32.768-khz crystal resonator. c s c 0 lr s x 1 x 2 c = 1.5 pf (typ.) r = 14 k (typ.) f = 32.768 khz crystal resonator: 0 s w ? s mx38t (nihon denpa kogyo) figure 4.8 equivalent circuit of 32.768-khz crystal resonator pin connection when not using subclock: when the subclock is not used, connect pin x 1 to v cc and leave pin x 2 open, as shown in figure 4.9. x x 1 2 v cc open figure 4.9 pin connection when not using subclock 4.4 prescalers the h8/3644 group is equipped with two on-chip prescalers having different input clocks (prescaler s and prescaler w). prescaler s is a 13-bit counter using the system clock ( ) as its input clock. its prescaled outputs provide internal clock signals for on-chip peripheral modules. prescaler w is a 5-bit counter using a 32.768-khz signal divided by 4 ( w /4) as its input clock. its prescaled outputs are used by timer a as a time base for timekeeping. prescaler s (pss): prescaler s is a 13-bit counter using the system clock ( ) as its input clock. it is incremented once per clock period. prescaler s is initialized to h'0000 by a reset, and starts counting on exit from the reset state.
section 4 clock pulse generators rev. 6.00 sep 12, 2006 page 86 of 526 rej09b0326-0600 in standby mode, watch mode, subactive mode, and subsleep mode, the system clock pulse generator stops. prescaler s also stops and is initialized to h'0000. the cpu cannot read or write prescaler s. the output from prescaler s is shared by the on-chip peripheral modules. the divider ratio can be set separately for each on-chip peripheral function. in active (medium-speed) mode the clock input to prescaler s is determined by the division factor designated by ma1 and ma0 in syscr1. prescaler w (psw): prescaler w is a 5-bit counter using a 32.768 khz signal divided by 4 ( w /4) as its input clock. prescaler w is initialized to h'00 by a reset, and starts counting on exit from the reset state. even in standby mode, watch mode, subactive mode, or subsleep mode, prescaler w continues functioning so long as clock signals are supplied to pins x 1 and x 2 . prescaler w can be reset by setting 1s in bits tma3 and tma2 of timer mode register a (tma). output from prescaler w can be used to drive timer a, in which case timer a functions as a time base for timekeeping. 4.5 note on oscillators oscillator characteristics are closely related to board design and should be carefully evaluated by the user, referring to the examples shown in this section. oscillator circuit constants will differ depending on the oscillator element, stray capacitance in its interconnecting circuit, and other factors. suitable constants should be determined in consultation with the oscillator element manufacturer. design the circuit so that the oscillator element never receives voltages exceeding its maximum rating.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 87 of 526 rej09b0326-0600 section 5 power-down modes 5.1 overview the h8/3644 group has eight modes of operation after a reset. these include seven power-down modes, in which power dissipation is significantly reduced. table 5.1 gives a summary of the eight operating modes. table 5.1 operating modes operating mode description active (high-speed) mode the cpu and all on-chip peripheral functions are operable on the system clock active (medium-speed) mode the cpu and all on-chip peripheral functions are operable on the system clock, but at 1/64, 1/32, 1/6, or 1/8 * the speed in active (high-speed) mode subactive mode the cpu, and the time-base function of timer a are operable on the subclock sleep (high-speed) mode the cpu halts. on-chip peripheral functions except pwm are operable on the system clock sleep (medium-speed) mode the cpu halts. on-chip peripheral functions except pwm are operable on the system clock, but at 1/64, 1/32, 1/6, or 1/8 * the speed in active (high-speed) mode subsleep mode the cpu halts. the time-base function of timer a are operable on the subclock watch mode the cpu halts. the time-base function of timer a is operable on the subclock standby mode the cpu and all on-chip peripheral functions halt note: * determined by the value set in bits ma1 and ma0 of system control register 1 (syscr1). of these eight operating modes, all but the active (high-speed) mode are power-down modes. in this section the two active modes (high-speed and medium speed) will be referred to collectively as active mode, and the two sleep modes (high-speed and medium speed) will be referred to collectively as sleep mode. figure 5.1 shows the transitions among these operation modes. table 5.2 indicates the internal states in each mode.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 88 of 526 rej09b0326-0600 reset state program halt state slee p instruction * d sleep instruction * e sleep instruction * c sleep instruction * h sleep instruction * i sleep instruction * g sleep instruction * f program execution state sleep instruction * a program halt state sleep instruction * i power-down modes a transition between different modes cannot be made to occur simply because an interrupt request is generated. make sure that interrupt handling is performed after the interrupt is accepted. details on the mode transition conditions are given in the explanations of each mode, in sections 5.2 through 5.8. notes: 1. 2. mode transition conditions (1) a b c d e f g h i j lson mson ssby dton 0 0 1 0 * 0 0 0 1 0 0 1 * * * 0 1 1 * 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 * don?t care mode transition conditions (2) 1 interrupt sources timer a interrupt, irq 0 interrupt timer a interrupt, irq 3 to irq 0 interrupts, int interrupt all interrupts irq 1 or irq 0 interrupt 2 3 4 * 3 * 3 * 2 * 1 * 4 * 4 * 1 standby mode watch mode subactive mode active (medium-speed) mode active (high-speed) mode sleep (high-speed) mode sleep (medium-speed) mode subsleep mode sleep instruction * a sleep instruction * e sleep instruction * d sleep instruction * b sleep instruction * j * 1 sleep instruction * e slee p instructio n * b tma3 * * 1 0 1 * * 1 1 1 figure 5.1 mode transition diagram
section 5 power-down modes rev. 6.00 sep 12, 2006 page 89 of 526 rej09b0326-0600 table 5.2 internal state in each operating mode active mode sleep mode function high- speed medium- speed high- speed medium- speed watch mode subactive mode subsleep mode standby mode system clock oscillator functions functions functions functions halted halted halted halted subclock oscillator functions functions functions functions functions functions functions functions cpu instructions functions functions halted halted halted functions halted halted operations registers retained retained retained retained retained ram i/o ports retained * 1 external irq 0 functions functions functions functions functions functions functions functions interrupts irq 1 retained * 2 irq 2 retained * 2 irq 3 int 0 functions functions functions functions retained * 2 functions functions retained * 2 int 1 int 2 int 3 int 4 int 5 int 6 int 7 peripheral timer a functions functions functions functions functions * 3 functions * 3 functions * 3 retained functions timer b1 retained retained retained timer v reset reset reset reset timer x watchdog timer retained retained retained retained sci1 sci3 reset reset reset reset pwm retained retained retained retained retained retained a/d converter functions functions notes: 1. register contents are retained, but output is high-impedance state. 2. external interrupt requests are ignored. interrupt request register contents are not altered. 3. functions if timekeeping time-base function is selected.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 90 of 526 rej09b0326-0600 5.1.1 system control registers the operation mode is selected using the system control registers described in table 5.3. table 5.3 system control registers name abbreviation r/w initial value address system control register 1 syscr1 r/w h'07 h'fff0 system control register 2 syscr2 r/w h'e0 h'fff1 system control register 1 (syscr1) bit 7 6 5 4 3 2 1 0 ssby sts2 sts1 sts0 lson ? ma1 ma0 initial value 0 0 0 0 0 1 1 1 read/write r/w r/w r/w r/w r/w ? r/w r/w syscr1 is an 8-bit read/write register for control of the power-down modes. upon reset, syscr1 is initialized to h'07. bit 7 ? ? ? ? software standby (ssby): this bit designates transition to standby mode or watch mode. bit 7: ssby description 0 ? when a sleep instruction is executed in active mode, a transition is made to sleep mode ? when a sleep instruction is executed in subactive mode, a transition is made to subsleep mode (initial value) 1 ? when a sleep instruction is executed in active mode, a transition is made to standby mode or watch mode ? when a sleep instruction is executed in subactive mode, a transition is made to watch mode
section 5 power-down modes rev. 6.00 sep 12, 2006 page 91 of 526 rej09b0326-0600 bits 6 to 4 ? ? ? ? standby timer select 2 to 0 (sts2 to sts0): these bits designate the time the cpu and peripheral modules wait for stable clock operation after exiting from standby mode or watch mode to active mode due to an interrupt. the designation should be made according to the clock frequency so that the waiting time is at least 10 ms. bit 6: sts2 bit 5: sts1 bit 4: sts0 description 0 0 0 wait time = 8,192 states (initial value) 1 wait time = 16,384 states 1 0 wait time = 32,768 states 1 wait time = 65,536 states 1 * * wait time = 131,072 states legend: * don?t care bit 3 ? ? ? ? low speed on flag (lson): this bit chooses the system clock ( ) or subclock ( sub ) as the cpu operating clock when watch mode is cleared. the resulting operation mode depends on the combination of other control bits and interrupt input. bit 3: lson description 0 the cpu operates on the system clock ( ) (initial value) 1 the cpu operates on the subclock ( sub ) bits 2 ? ? ? ? reserved bits: bit 2 is reserved: it is always read as 1 and cannot be modified. bits 1 and 0 ? ? ? ? active (medium-speed) mode clock select (ma1, ma0): bits 1 and 0 choose osc /128, osc /64, osc /32, or osc /16 as the operating clock in active (medium-speed) mode and sleep (medium-speed) mode. ma1 and ma0 should be written in active (high-speed) mode or subactive mode. bit 1: ma1 bit 0: ma0 description 0 0 osc /16 1 osc /32 1 0 osc /64 1 osc /128 (initial value)
section 5 power-down modes rev. 6.00 sep 12, 2006 page 92 of 526 rej09b0326-0600 system control register 2 (syscr2) bit 7 6 5 4 3 2 1 0 ? ? ? nesel dton mson sa1 sa0 initial value 1 1 1 0 0 0 0 0 read/write ? ? ? r/w r/w r/w r/w r/w syscr2 is an 8-bit read/write register for power-down mode control. upon reset, syscr2 is initialized to h'e0. bits 7 to 5 ? ? ? ? reserved bits: these bits are reserved; they are always read as 1, and cannot be modified. bit 4 ? ? ? ? noise elimination sampling frequency select (nesel): this bit selects the frequency at which the watch clock signal ( w ) generated by the subclock pulse generator is sampled, in relation to the oscillator clock ( osc ) generated by the system clock pulse generator. when osc = 2 to 10 mhz, clear nesel to 0. bit 4: nesel description 0 sampling rate is osc /16 (initial value) 1 sampling rate is osc /4
section 5 power-down modes rev. 6.00 sep 12, 2006 page 93 of 526 rej09b0326-0600 bit 3 ? ? ? ? direct transfer on flag (dton): this bit designates whether or not to make direct transitions among active (high-speed), active (medium-speed) and subactive mode when a sleep instruction is executed. the mode to which the transition is made after the sleep instruction is executed depends on a combination of this and other control bits. bit 3: dton description 0 ? when a sleep instruction is executed in active mode, a transition is made to standby mode, watch mode, or sleep mode ? when a sleep instruction is executed in subactive mode, a transition is made to watch mode or subsleep mode (initial value) 1 ? when a sleep instruction is executed in active (high-speed) mode, a direct transition is made to active (medium-speed) mode if ssby = 0, mson = 1, and lson = 0, or to subactive mode if ssby = 1, tma3 = 1, and lson = 1 ? when a sleep instruction is executed in active (medium-speed) mode, a direct transition is made to active (high-speed) mode if ssby = 0, mson = 0, and lson = 0, or to subactive mode if ssby = 1, tma3 = 1, and lson = 1 ? when a sleep instruction is executed in subactive mode, a direct transition is made to active (high-speed) mode if ssby = 1, tma3 = 1, lson = 0, and mson = 0, or to active (medium-speed) mode if ssby = 1, tma3 = 1, lson = 0, and mson = 1 bit 2 ? ? ? ? medium speed on flag (mson): after standby, watch, or sleep mode is cleared, this bit selects active (high-speed), active (medium-speed), or sleep (medium-speed) mode. bit 2: mson description 0 ? after standby, watch, or sleep mode is cleared, operation is in active (high- speed) mode ? when a sleep instruction is executed in active mode, a transition is made to sleep (high-speed) mode (initial value) 1 ? after standby, watch, or sleep mode is cleared, operation is in active (medium-speed) mode ? when a sleep instruction is executed in active mode, a transition is made to sleep (medium-speed) mode
section 5 power-down modes rev. 6.00 sep 12, 2006 page 94 of 526 rej09b0326-0600 bits 1 and 0 ? ? ? ? subactive mode clock select (sa1 and sa0): these bits select the cpu clock rate ( w /2, w /4, or w /8) in subactive mode. sa1 and sa0 cannot be modified in subactive mode. bit 1: sa1 bit 0: sa0 description 0 0 w /8 (initial value) 1 w /4 1 * w /2 legend: * don?t care 5.2 sleep mode 5.2.1 transition to sleep mode transition to sleep (high-speed) mode: the system goes from active mode to sleep (high- speed) mode when a sleep instruction is executed while the ssby and lson bits in syscr1 and the mson and dton bits in syscr2 are all cleared to 0. in sleep (high-speed) mode cpu operation is halted but the on-chip peripheral functions other than pwm are operational. cpu register contents are retained. transition to sleep (medium-speed) mode: the system goes from active mode to sleep (medium-speed) mode when a sleep instruction is executed while the ssby and lson bits in syscr1 are cleared to 0, the mson bit in syscr2 is set to 1, and the dton bit in syscr2 is cleared to 0. in sleep (medium-speed) mode, as in sleep (high-speed) mode, cpu operation is halted but the on-chip peripheral functions other than pwm are operational. the clock frequency in sleep (medium-speed) mode is determined by the ma1 and ma0 bits in syscr1. cpu register contents are retained. 5.2.2 clearing sleep mode sleep mode is cleared by any interrupt (timer a, timer b1, timer x, timer v, irq 3 to irq 0 , int 7 to int 0 , sci 3 , sci 1 , or a/d converter), or by input at the res pin. ? clearing by interrupt when an interrupt is requested, sleep mode is cleared and interrupt exception handling starts. a transition is made from sleep (high-speed) mode to active (high-speed) mode, or from sleep (medium-speed) mode to active (medium-speed) mode. sleep mode is not cleared if the i bit of the condition code register (ccr) is set to 1 or the particular interrupt is disabled in the interrupt enable register.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 95 of 526 rej09b0326-0600 ? clearing by res input when the res pin goes low, the cpu goes into the reset state and sleep mode is cleared. 5.2.3 clock frequency in sleep (medium-speed) mode operation in sleep (medium-speed) mode is clocked at the frequency designated by the ma1 and ma0 bits in syscr1. 5.3 standby mode 5.3.1 transition to standby mode the system goes from active mode to standby mode when a sleep instruction is executed while the ssby bit in syscr1 is set to 1, the lson bit in syscr1 is cleared to 0, and bit tma3 in tma is cleared to 0. in standby mode the clock pulse generator stops, so the cpu and on-chip peripheral modules stop functioning, but as long as the rated voltage is supplied, the contents of cpu registers, on-chip ram, and some on-chip peripheral module registers are retained. on-chip ram contents will be further retained down to a minimum ram data retention voltage. the i/o ports go to the high-impedance state. 5.3.2 clearing standby mode standby mode is cleared by an interrupt (irq 1 or irq 0 ) or by input at the res pin. ? clearing by interrupt when an interrupt is requested, the system clock pulse generator starts. after the time set in bits sts2?sts0 in syscr1 has elapsed, a stable system clock signal is supplied to the entire chip, standby mode is cleared, and interrupt exception handling starts. operation resumes in active (high-speed) mode if mson = 0 in syscr2, or active (medium-speed) mode if mson = 1. standby mode is not cleared if the i bit of ccr is set to 1 or the particular interrupt is disabled in the interrupt enable register. ? clearing by res input when the res pin goes low, the system clock pulse generator starts. after the pulse generator output has stabilized, if the res pin is driven high, the cpu starts reset exception handling. since system clock signals are supplied to the entire chip as soon as the system clock pulse generator starts functioning, the res pin should be kept at the low level until the pulse generator output stabilizes.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 96 of 526 rej09b0326-0600 5.3.3 oscillator settling time after standby mode is cleared bits sts2 to sts0 in syscr1 should be set as follows. ? when a crystal oscillator is used the table 5.4 gives settings for various operating frequencies. set bits sts2 to sts0 for a waiting time of at least 10 ms. table 5.4 clock frequency and settling time (times are in ms) sts2 sts1 sts0 waiting time 5 mhz 4 mhz 2 mhz 1 mhz 0.5 mhz 0 0 0 8,192 states 1.6 2.0 4.1 8.2 16.4 0 0 1 16,384 states 3.2 4.1 8.2 16.4 32.8 0 1 0 32,768 states 6.6 8.2 16.4 32.8 65.5 0 1 1 65,536 states 13.1 16.4 32.8 65.5 131.1 1 * * 131,072 states 26.2 32.8 65.5 131.1 262.1 legend: * don?t care ? when an external clock is used any values may be set. normally the minimum time (sts2 = sts1 = sts0 = 0) should be set. 5.4 watch mode 5.4.1 transition to watch mode the system goes from active or subactive mode to watch mode when a sleep instruction is executed while the ssby bit in syscr1 is set to 1 and bit tma3 in tma is set to 1. in watch mode, operation of on-chip peripheral modules other than timer a is halted. as long as a minimum required voltage is applied, the contents of cpu registers, the on-chip ram and some registers of the on-chip peripheral modules, are retained. i/o ports keep the same states as before the transition.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 97 of 526 rej09b0326-0600 5.4.2 clearing watch mode watch mode is cleared by an interrupt (timer a or irq 0 ) or by input at the res pin. ? clearing by interrupt when watch mode is cleared by a timer a interrupt or irq 0 interrupt, the mode to which a transition is made depends on the settings of lson in syscr1 and mson in syscr2. if both lson and mson are cleared to 0, transition is to active (high-speed) mode; if lson = 0 and mson = 1, transition is to active (medium-speed) mode; if lson = 1, transition is to subactive mode. when the transition is to active mode, after the time set in syscr1 bits sts2 to sts0 has elapsed, a stable clock signal is supplied to the entire chip, watch mode is cleared, and interrupt exception handling starts. watch mode is not cleared if the i bit of ccr is set to 1 or the particular interrupt is disabled in the interrupt enable register. ? clearing by res input clearing by res pin is the same as for standby mode; see section 5.3.2, clearing standby mode. 5.4.3 oscillator settling time after watch mode is cleared the waiting time is the same as for standby mode; see section 5.3.3, oscillator settling time after standby mode is cleared. 5.5 subsleep mode 5.5.1 transition to subsleep mode the system goes from subactive mode to subsleep mode when a sleep instruction is executed while the ssby bit in syscr1 is cleared to 0, lson bit in syscr1 is set to 1, and tma3 bit in tma is set to 1. in subsleep mode, operation of on-chip peripheral modules other than timer a is halted. as long as a minimum required voltage is applied, the contents of cpu registers, the on- chip ram and some registers of the on-chip peripheral modules are retained. i/o ports keep the same states as before the transition.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 98 of 526 rej09b0326-0600 5.5.2 clearing subsleep mode subsleep mode is cleared by an interrupt (timer a, irq 3 to irq 0 , int 7 to int 0 ) or by input at the res pin. ? clearing by interrupt when an interrupt is requested, subsleep mode is cleared and interrupt exception handling starts. subsleep mode is not cleared if the i bit of ccr is set to 1 or the particular interrupt is disabled in the interrupt enable register. ? clearing by res input clearing by res pin is the same as for standby mode; see section 5.3.2, clearing standby mode. 5.6 subactive mode 5.6.1 transition to subactive mode subactive mode is entered from watch mode if a timer a or irq 0 interrupt is requested while the lson bit in syscr1 is set to 1. from subsleep mode, subactive mode is entered if a timer a, irq 3 to irq 0 , or int 7 to int 0 interrupt is requested. a transition to subactive mode does not take place if the i bit of ccr is set to 1 or the particular interrupt is disabled in the interrupt enable register. 5.6.2 clearing subactive mode subactive mode is cleared by a sleep instruction or by input at the res pin. ? clearing by sleep instruction if a sleep instruction is executed while the ssby bit in syscr1 is set to 1 and tma3 bit in tma is set to 1, subactive mode is cleared and watch mode is entered. if a sleep instruction is executed while ssby = 0 and lson = 1 in syscr1 and tma3 = 1 in tma, subsleep mode is entered. direct transfer to active mode is also possible; see section 5.8, direct transfer, below. ? clearing by res pin clearing by res pin is the same as for standby mode; see section 5.3.2, clearing standby mode.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 99 of 526 rej09b0326-0600 5.6.3 operating frequency in subactive mode the operating frequency in subactive mode is set in bits sa1 and sa0 in syscr2. the choices are w /2, w /4, and w /8. 5.7 active (medium-speed) mode 5.7.1 transition to active (medium-speed) mode if the mson bit in syscr2 is set to 1 while the lson bit in syscr1 is cleared to 0, a transition to active (medium-speed) mode results from irq 0 or irq 1 interrupts in standby mode, timer a or irq 0 interrupts in watch mode, or any interrupt in sleep (medium-speed) mode. a transition to active (medium-speed) mode does not take place if the i bit of ccr is set to 1 or the particular interrupt is disabled in the interrupt enable register. 5.7.2 clearing active (medium-speed) mode active (medium-speed) mode is cleared by a sleep instruction or by input at the res pin. ? clearing by sleep instruction a transition to standby mode takes place if the sleep instruction is executed while the ssby bit in syscr1 is set to 1, the lson bit in syscr1 is cleared to 0, and the tma3 bit in tma is cleared to 0. the system goes to watch mode if the ssby bit in syscr1 is set to 1 and bit tma3 in tma is set to 1 when a sleep instruction is executed. when both ssby and lson are cleared to 0 in syscr1 and a sleep instruction is executed, sleep (high-speed) mode is entered if mson is cleared to 0 in syscr2, and sleep (medium- speed) mode is entered if mson is set to 1. direct transfer to active (high-speed) mode or to subactive mode is also possible. see section 5.8, direct transfer, below for details. ? clearing by res pin when the res pin goes low, the cpu enters the reset state and active (medium-speed) mode is cleared. 5.7.3 operating frequency in active (medium-speed) mode operation in active (medium-speed) mode is clocked at the frequency designated by the ma1 and ma0 bits in syscr1.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 100 of 526 rej09b0326-0600 5.8 direct transfer the cpu can execute programs in three modes: active (high-speed) mode, active (medium-speed) mode, and subactive mode. a direct transfer is a transition among these three modes without the stopping of program execution. a direct transfer can be made by executing a sleep instruction while the dton bit in syscr2 is set to 1. after the mode transition, direct transfer interrupt exception handling starts. if the direct transfer interrupt is disabled in interrupt enable register 2, a transition is made instead to sleep mode or watch mode. note that if a direct transition is attempted while the i bit in ccr is set to 1, sleep mode or watch mode will be entered, and it will be impossible to clear the resulting mode by means of an interrupt. ? direct transfer from active (high-speed) mode to active (medium-speed) mode when a sleep instruction is executed in active (high-speed) mode while the ssby and lson bits in syscr1 are cleared to 0, the mson bit in syscr2 is set to 1, and the dton bit in syscr2 is set to 1, a transition is made to active (medium-speed) mode via sleep mode. ? direct transfer from active (medium-speed) mode to active (high-speed) mode when a sleep instruction is executed in active (medium-speed) mode while the ssby and lson bits in syscr1 are cleared to 0, the mson bit in syscr2 is cleared to 0, and the dton bit in syscr2 is set to 1, a transition is made to active (high-speed) mode via sleep mode. ? direct transfer from active (high-speed) mode to subactive mode when a sleep instruction is executed in active (high-speed) mode while the ssby and lson bits in syscr1 are set to 1, the dton bit in syscr2 is set to 1, and the tma3 bit in tma is set to 1, a transition is made to subactive mode via watch mode. ? direct transfer from subactive mode to active (high-speed) mode when a sleep instruction is executed in subactive mode while the ssby bit in syscr1 is set to 1, the lson bit in syscr1 is cleared to 0, the mson bit in syscr2 is cleared to 0, the dton bit in syscr2 is set to 1, and the tma3 bit in tma is set to 1, a transition is made directly to active (high-speed) mode via watch mode after the waiting time set in syscr1 bits sts2 to sts0 has elapsed. ? direct transfer from active (medium-speed) mode to subactive mode when a sleep instruction is executed in active (medium-speed) while the ssby and lson bits in syscr1 are set to 1, the dton bit in syscr2 is set to 1, and the tma3 bit in tma is set to 1, a transition is made to subactive mode via watch mode.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 101 of 526 rej09b0326-0600 ? direct transfer from subactive mode to active (medium-speed) mode when a sleep instruction is executed in subactive mode while the ssby bit in syscr1 is set to 1, the lson bit in syscr1 is cleared to 0, the mson bit in syscr2 is set to 1, the dton bit in syscr2 is set to 1, and the tma3 bit in tma is set to 1, a transition is made directly to active (medium-speed) mode via watch mode after the waiting time set in syscr1 bits sts2 to sts0 has elapsed.
section 5 power-down modes rev. 6.00 sep 12, 2006 page 102 of 526 rej09b0326-0600
section 6 rom rev. 6.00 sep 12, 2006 page 103 of 526 rej09b0326-0600 section 6 rom 6.1 overview the h8/3644 has 32 kbytes of on-chip mask rom, prom or flash memory. the h8/3643 has 24 kbytes of mask rom or flash memory. the h8/3642 has 16 kbytes of mask rom or flash memory. the h8/3641 has 12 kbytes of on-chip rom. h8/3640 has 8 kbytes of rom. the rom is connected to the cpu by a 16-bit data bus, allowing high-speed two-state access for both byte data and word data. in the prom version (h8/3644 ztat) and flash memory versions (h8/3644 f-ztat, h8/3643 f-ztat, h8/3642 af-ztat), programs can be written and erased with a general-purpose prom programmer. in the on-chip flash memory versions, programs can be written and erased on-board. 6.1.1 block diagram figure 6.1 shows a block diagram of the on-chip rom. h'7ffe h'7fff internal data bus (upper 8 bits) internal data bus (lower 8 bits) even-numbered address odd-numbered address h'7ffe h'0002 h'0000 h'0000 h'0002 h'0001 h'0003 on-chip rom figure 6.1 rom block diagram (h8/3644)
section 6 rom rev. 6.00 sep 12, 2006 page 104 of 526 rej09b0326-0600 6.2 prom mode 6.2.1 setting to prom mode if the on-chip rom is prom, setting the chip to prom mode stops operation as a microcontroller and allows the prom to be programmed in the same way as the standard hn27c256 eprom. table 6.1 shows how to set the chip to prom mode. table 6.1 setting to prom mode pin name setting test high level pb 4 /an 4 low level pb 5 /an 5 pb 6 /an 6 high level 6.2.2 memory map figure 6.2 shows a memory map. on-chip prom h'0000 h'7fff h'0000 h'7fff address in mcu mode address in prom mode figure 6.2 h8/3644 memory map in prom mode when programming with a prom programmer, be sure to specify addresses from h'0000 to h'7fff.
section 6 rom rev. 6.00 sep 12, 2006 page 105 of 526 rej09b0326-0600 6.3 programming the h8/3644 write, verify, and other modes are selected as shown in table 6.2 in prom mode. table 6.2 mode selection in prom mode (h8/3644) pin mode ce ce ce ce oe oe oe oe v pp v cc eo 7 to eo 0 ea 14 to ea 0 write l h v pp v cc data input address input verify h l v pp v cc data output address input programming disabled h h v pp v cc high impedance address input legend: l: low level h: high level v pp : v pp level v cc : v cc level the specifications for writing and reading are identical to those for the standard hn27c256 eprom.
section 6 rom rev. 6.00 sep 12, 2006 page 106 of 526 rej09b0326-0600 6.3.1 writing and verifying an efficient, high-speed, high-reliability method is available for writing and verifying the prom data. this method achieves high speed without voltage stress on the device and without lowering the reliability of written data. data in unused address areas has a value of h'ff. the basic flow of this high-speed, high-reliability programming method is shown in figure 6.3. start set write/verify mode v = 6.0 v 0.25 v, v = 12.5 v 0.3 v cc pp address = 0 n = 0 n + 1 n pw verify write time t = 3n ms opw last address? set read mode v cc = 5.0 v 0.5 v, v pp = v cc read all addresses? end error n 25 < address + 1 address no yes ng ok yes no ng yes write time t = 0.2 ms 5% figure 6.3 high-speed, high-reliability programming flow chart
section 6 rom rev. 6.00 sep 12, 2006 page 107 of 526 rej09b0326-0600 table 6.3 and table 6.4 give the electrical characteristics in programming mode. table 6.3 dc characteristics (conditions: v cc = 6.0 v 0.25 v, v pp = 12.5 v 0.3 v, v ss = 0 v, t a = 25c 5c) item symbol min typ max unit test condition input high- level voltage eo 7 to eo 0 , ea 14 to ea 0 oe , ce v ih 2.4 ? v cc +0.3 v input low- level voltage eo 7 to eo 0 , ea 14 to ea 0 oe , ce v il ?0.3 ? 0.8 v output high- level voltage eo 7 to eo 0 v oh 2.4 ? ? v i oh = ?200 a output low- level voltage eo 7 to eo 0 v ol ? ? 0.45 v i ol = 0.8 ma input leakage current eo 7 to eo 0 , ea 14 to ea 0 oe , ce |i li | ? ? 2 a v in = 5.25 v/ 0.5 v v cc current i cc ? ? 40 ma v pp current i pp ? ? 40 ma
section 6 rom rev. 6.00 sep 12, 2006 page 108 of 526 rej09b0326-0600 table 6.4 ac characteristics (conditions: v cc = 6.0 v 0.25 v, v pp = 12.5 v 0.3 v, t a = 25c 5c) item symbol min typ max unit test condition address setup time t as 2 ? ? s figure 6.4 * 1 oe setup time t oes 2 ? ? s data setup time t ds 2 ? ? s address hold time t ah 0 ? ? s data hold time t dh 2 ? ? s data output disable time t df * 2 0 ? 130 ns v pp setup time t vps 2 ? ? s programming pulse width t pw 0.95 1.0 1.05 ms ce pulse width for overwrite programming t opw * 3 2.85 ? 78.7 ms v cc setup time t vcs 2 ? ? s data output delay time t oe 0 ? 500 ns notes: 1. input pulse level: 0.8 v to 2.2 v input rise time/fall time 20 ns timing reference levels: input: 1.0 v, 2.0 v output: 0.8 v, 2.0 v 2. t df is defined at the point at which the output is floating and the output level cannot be read. 3. t opw is defined by the value given in figure 6.3, high-speed, high-reliability programming flow chart.
section 6 rom rev. 6.00 sep 12, 2006 page 109 of 526 rej09b0326-0600 figure 6.4 shows a prom write/verify timing diagram. address data v pp v cc ce oe v pp v cc v cc v cc write verify input data output data t as t ds t vps t vcs t pw t opw * t dh t oes t oe t df t ah note: * t opw is defined by the value given in figure 6.3, high-speed, high-reliability programming flow chart. +1 figure 6.4 prom write/verify timing 6.3.2 programming precautions ? use the specified programming voltage and timing. the programming voltage in prom mode (v pp ) is 12.5 v. use of a higher voltage can permanently damage the chip. be especially careful with respect to prom programmer overshoot. setting the prom programmer to renesas technology specifications for the hn27c256 will result in correct v pp of 12.5 v. ? make sure the index marks on the prom programmer socket, socket adapter, and chip are properly aligned. if they are not, the chip may be destroyed by excessive current flow. before programming, be sure that the chip is properly mounted in the prom programmer.
section 6 rom rev. 6.00 sep 12, 2006 page 110 of 526 rej09b0326-0600 ? avoid touching the socket adapter or chip while programming, since this may cause contact faults and write errors. 6.3.3 reliability of programmed data a highly effective way to improve data retention characteristics is to bake the programmed chips at 150c, then screen them for data errors. this procedure quickly eliminates chips with prom memory cells prone to early failure. figure 6.5 shows the recommended screening procedure. program chip and verify programmed data bake chip for 24 to 48 hours at 125 c to 150 c with power off read and check program install figure 6.5 recommended screening procedure if a group of programming errors occurs while the same prom programmer is in use, stop programming and check the prom programmer and socket adapter for defects, using a microcomputer with on-chip eprom in a windowed package, etc. please inform renesas technology of any abnormal conditions noted during or after programming or in screening of program data after high-temperature baking.
section 6 rom rev. 6.00 sep 12, 2006 page 111 of 526 rej09b0326-0600 6.4 flash memory overview 6.4.1 principle of flash memory operation table 6.5 illustrates the principle of operation of the on-chip flash memory in the h8/3644f, h8/3643f, and h8/3642af. like eprom, flash memory is programmed by applying a high gate-to-drain voltage that draws hot electrons generated in the vicinity of the drain into a floating gate. the threshold voltage of a programmed memory cell is therefore higher than that of an erased cell. cells are erased by grounding the gate and applying a high voltage to the source, causing the electrons stored in the floating gate to tunnel out. after erasure, the threshold voltage drops. a memory cell is read like an eprom cell, by driving the gate to a high level and detecting the drain current, which depends on the threshold voltage. erasing must be done carefully, because if a memory cell is overerased, its threshold voltage may become negative, causing the cell to operate incorrectly. section 6.7.6, erase flowcharts and sample programs, shows optimal erase control flowcharts and sample programs. table 6.5 principle of memory cell operation program erase read memory cell vg = v pp vd vs = v pp open vg = v cc vd memory array v pp vd 0 v 0 v 0 v 0 v open v pp open 0 v v cc vd 0 v 0 v 0 v
section 6 rom rev. 6.00 sep 12, 2006 page 112 of 526 rej09b0326-0600 6.4.2 mode pin settings and rom space the h8/3644f has 32 kbytes of on-chip flash memory, the h8/3643f has 24 kbytes, and the h8/3642af has 16 kbytes. the rom is connected to the cpu by a 16-bit data bus. the cpu accesses flash memory in two states for both byte-size and word-size instructions. the flash memory is allocated to addresses h'0000 to h'7fff in the h8/3644f, to addresses h'0000 to h'5fff in the h8/3643f, and to addresses h'0000 to h'3fff in the h8/3642af. 6.4.3 features the features of the flash memory are summarized below. ? five flash memory operating modes there are five flash memory operating modes: program mode, program-verify mode, erase mode, erase-verify mode, and prewrite-verify mode. ? erase block specification blocks to be erased in the flash memory space can be specified by setting the corresponding register bits. the address space includes a large block area (four blocks with sizes from 4 kbytes to 8 kbytes) and a small block area (eight blocks with sizes from 128 bytes to 1 kbyte). ? programming/erase times the flash memory programming time is 50 s (typ.) per byte, and the erase time is 1 s (typ.). ? erase-program cycles flash memory contents can be erased and reprogrammed up to 100 times. ? on-board programming modes there are two modes in which flash memory can be programmed, erased, and verified on- board: boot mode and user program mode. ? automatic bit rate adjustment for data transfer in boot mode, the chip?s bit rate can be automatically adjusted to match the transfer bit rate of the host (max. 9600 bps). ? prom mode flash memory can be programmed and erased in prom mode, using a general-purpose prom programmer, as well as in on-board programming mode. the specifications for programming, erasing, verifying, etc., are the same as for standard hn28f101 flash memory.
section 6 rom rev. 6.00 sep 12, 2006 page 113 of 526 rej09b0326-0600 6.4.4 block diagram figure 6.6 shows a block diagram of the flash memory. internal data bus (lower) bus interface/control section flmcr ebr1 ebr2 8 internal data bus (upper) 8 test operating mode upper byte (even address) on-chip flash memory (32 kbytes) h'0000 h'0002 h'0004 h'0001 h'0003 h'0005 h'7ffc h'7ffe h'7ffd h'7fff lower byte (odd address) legend: flmcr: flash memory control register ebr1: erase block register 1 ebr2: erase block register 2 figure 6.6 block diagram of flash memory (example of the h8/3644f)
section 6 rom rev. 6.00 sep 12, 2006 page 114 of 526 rej09b0326-0600 6.4.5 pin configuration the flash memory is controlled by means of the pins shown in table 6.6. table 6.6 flash memory pins pin name abbreviation input/output function programming power fv pp power supply apply 12.0 v mode pin test input sets h8/3644f operating mode transmit data txd output sci3 transmit data output receive data rxd input sci3 receive data input the transmit data pin and receive data pin are used in boot mode. 6.4.6 register configuration the registers used to control the on-chip flash memory are shown in table 6.7. table 6.7 flash memory registers register name abbreviation r/w initial value address flash memory control register flmcr r/w h'00 h'ff80 erase block register 1 ebr1 r/w h'f0 h'ff82 erase block register 2 ebr2 r/w h'00 h'ff83 the flmcr, ebr1, and ebr2 registers are valid only when programming and erasing flash memory, and can only be accessed when 12 v is applied to the fv pp pin. when 12 v is not applied to the fv pp pin, addresses h'ff80 to h'ff83 cannot be modified and are always read as h'ff.
section 6 rom rev. 6.00 sep 12, 2006 page 115 of 526 rej09b0326-0600 6.5 flash memory register descriptions 6.5.1 flash memory control register (flmcr) flmcr is an 8-bit register used for flash memory operating mode control. transitions to program mode, erase mode, program-verify mode, and erase-verify mode are made by setting bits in this register. flmcr is initialized to h'00 upon reset, in sleep mode, subsleep mode, watch mode, and standby mode, and when 12 v is not applied to fv pp . when 12 v is applied to fv pp , a reset initializes flmcr to h'80. bit 7 6 5 4 3 2 1 0 v pp ? ? ? ev pv e p initial value 0 0 0 0 0 0 0 0 read/write r ? ? ? r/w * r/w * r/w * r/w * note: * for information on access to this register, see note 11 in section 6.9, flash memory programming and erasing precautions. bit 7 ? ? ? ? programming power (v pp ): bit 7 is a status flag that indicates that 12 v is applied to the fv pp pin. for further information, see note 5 in section 6.9, flash memory programming and erasing precautions. bit 7: v pp description 0 clearing condition: (initial value) when 12 v is not applied to the fv pp pin 1 setting condition: when 12 v is applied to the fv pp pin bit 3 ? ? ? ? erase-verify mode (ev) * : bit 3 selects transition to or exit from erase-verify mode. bit 3: ev description 0 exit from erase-verify mode (initial value) 1 transition to erase-verify mode note: * do not set multiple bits simultaneously. do not release or cut the v cc or v pp power supply while a bit is set.
section 6 rom rev. 6.00 sep 12, 2006 page 116 of 526 rej09b0326-0600 bit 2 ? ? ? ? program-verify mode (pv) * : bit 2 selects transition to or exit from program-verify mode. bit 2: pv description 0 exit from program-verify mode (initial value) 1 transition to program-verify mode note: * do not set multiple bits simultaneously. do not release or cut the v cc or v pp power supply while a bit is set. bit 1 ? ? ? ? erase mode (e) * 1 * 2 : bit 1 selects transition to or exit from erase mode. bit 1: e description 0 exit from erase mode (initial value) 1 transition to erase mode notes: 1. do not set multiple bits simultaneously. do not release or cut the v cc or v pp power supply while a bit is set. 2. p bit and e bit setting should be carried out in accordance with the program/erase algorithms shown in section 6.7, programming and erasing flash memory. a watchdog timer setting should be made beforehand to prevent the p or e bit from being set for longer than the specified time. see section 6.9, flash memory programming and erasing precautions, for more information on the use of these bits. bit 0 ? ? ? ? program mode (p) * 1 * 2 : bit 0 selects transition to or exit from program mode. bit 0: p description 0 exit from program mode (initial value) 1 transition to program mode notes: 1. do not set multiple bits simultaneously. do not release or cut the v cc or v pp power supply while a bit is set. 2. p bit and e bit setting should be carried out in accordance with the program/erase algorithms shown in section 6.7, programming and erasing flash memory. a watchdog timer setting should be made beforehand to prevent the p or e bit from being set for longer than the specified time. see section 6.9, flash memory programming and erasing precautions, for more information on the use of these bits.
section 6 rom rev. 6.00 sep 12, 2006 page 117 of 526 rej09b0326-0600 6.5.2 erase block register 1 (ebr1) ebr1 is an 8-bit register that specifies large flash-memory blocks for programming or erasure. ebr1 is initialized to h'f0 upon reset, in sleep mode, subsleep mode, watch mode, and standby mode, and when 12 v is not applied to fv pp . when a bit in ebr1 is set to 1, the corresponding block is selected and can be programmed and erased. the erase block map is shown in figure 6.7, and the correspondence between bits and erase blocks is shown in table 6.8. bit 7 6 5 4 3 2 1 0 ? ? ? ? lb3 lb2 lb1 lb0 initial value 1 1 1 1 0 0 0 0 read/write ? ? ? ? r/w * r/w * r/w * r/w * note: * word access cannot be used on this register; byte access must be used. for information on access to this register, see note 11 in section 6.9, flash memory programming and erasing precautions. lb3 is invalid in the h8/3643f, and lb3 and lb2 are invalid in the h8/3642af. bits 7 to 4 ? ? ? ? reserved: bits 7 to 4 are reserved; they are always read as 1, and cannot be modified. bits 3 to 0 ? ? ? ? large block 3 to 0 (lb3 to lb0): these bits select large blocks (lb3 to lb0) to be programmed and erased. bits 3 to 0: lb3 to lb0 description 0 block lb3 to lb0 is not selected (initial value) 1 block lb3 to lb0 is selected
section 6 rom rev. 6.00 sep 12, 2006 page 118 of 526 rej09b0326-0600 6.5.3 erase block register 2 (ebr2) ebr2 is an 8-bit register that specifies small flash-memory blocks for programming or erasure. ebr2 is initialized to h'00 upon reset, in sleep mode, subsleep mode, watch mode, and standby mode, and when 12 v is not applied to fv pp . when a bit in ebr2 is set to 1, the corresponding block is selected and can be programmed and erased. the erase block map is shown in figure 6.7, and the correspondence between bits and erase blocks is shown in table 6.8. bit 7 6 5 4 3 2 1 0 sb7 sb6 sb5 sb4 sb3 sb2 sb1 sb0 initial value 0 0 0 0 0 0 0 0 read/write r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * note: * word access cannot be used on this register; byte access must be used. for information on access to this register, see note 11 in section 6.9, flash memory programming and erasing precautions. lb3 is invalid in the h8/3643f, and lb3 and lb2 are invalid in the h8/3642af. bits 7 to 0 ? ? ? ? small block 7 to 0 (sb7 to sb0): these bits select small blocks (sb7 to sb0) to be programmed and erased. bits 7 to 0: sb7 to sb0 description 0 block sb7 to sb0 is not selected (initial value) 1 block sb7 to sb0 is selected
section 6 rom rev. 6.00 sep 12, 2006 page 119 of 526 rej09b0326-0600 h'7fff h'5fff h'6000 lb2 (8 kbytes) h'3fff h'4000 lb1 (8 kbytes) h'1fff h'2000 lb0 (4 kbytes) h'0fff h'1000 sb7 to sb0 (4 kbytes) small block area (4 kbytes) large block area (h8/3644f: 28 kbytes) (h8/3643f: 20 kbytes) (h8/3642af: 12 kbytes) h'0000 lb3 (8 kbytes) h'0fff h'0bff h'0c00 sb6 (1 kbyte) h'07ff h'0800 sb5 (1 kbyte) h'03ff h'0400 sb4 (512 bytes) h'01ff h'0200 sb0 (128 bytes) sb1 (128 bytes) sb2 (128 bytes) sb3 (128 bytes) h'0000 sb7 (1 kbyte) figure 6.7 erase block map table 6.8 correspondence between erase blocks and ebr1/ebr2 bits register bit block addresses size ebr1 0 lb0 h'1000 to h'1fff 4 kbytes 1 lb1 h'2000 to h'3fff 8 kbytes 2 lb2 h'4000 to h'5fff 8 kbytes 3 lb3 h'6000 to h'7fff 8 kbytes register bit block addresses size ebr2 0 sb0 h'0000 to h'007f 128 bytes 1 sb1 h'0080 to h'00ff 128 bytes 2 sb2 h'0100 to h'017f 128 bytes 3 sb3 h'0180 to h'01ff 128 bytes 4 sb4 h'0200 to h'03ff 512 bytes 5 sb5 h'0400 to h'07ff 1 kbyte 6 sb6 h'0800 to h'0bff 1 kbyte 7 sb7 h'0c00 to h'0fff 1 kbyte
section 6 rom rev. 6.00 sep 12, 2006 page 120 of 526 rej09b0326-0600 6.6 on-board programming modes when an on-board programming mode is selected, on-chip flash memory programming, erasing, and verifying can be carried out. there are two on-board programming modes ? boot mode and user program mode ? set by the mode pin (test) and the fv pp pin. table 6.9 shows how to select the on-board programming modes. for information on turning v pp on and off, see note 5 in section 6.9, flash memory programming and erasing precautions. table 6.9 on-board programming mode selection mode setting fv pp test notes boot mode 12 v * 12 v * user program mode v ss note: * see notes 6 to 8 in section 6.6.1, notes on use of boot mode, for the timing of 12 v application. 6.6.1 boot mode when boot mode is used, a user program for flash memory programming and erasing must be prepared beforehand in the host machine (which may be a personal computer). sci3 is used in asynchronous mode (see figure 6.8). when the h8/3644f, h8/3643f, or h8/3642af is set to boot mode, after reset release a built-in boot program is activated, the low period of the data sent from the host is first measured, and the bit rate register (brr) value determined. the chip?s on-chip serial communication interface (sci3) can then be used to download the user program from the host machine. the downloaded user program is written into ram. after the program has been stored, execution branches to the start address (h'fbe0) of the on-chip ram, the program stored in ram is executed, and flash memory programming/erasing can be carried out. figure 6.9 shows the boot mode execution procedure. host reception of programming data h8/3644f, h8/3643f, or h8/3642af rxd txd sci3 transmission of verify data figure 6.8 boot mode system configuration
section 6 rom rev. 6.00 sep 12, 2006 page 121 of 526 rej09b0326-0600 boot mode execution procedure: the boot mode execution procedure is shown below. set pins to boot mode for chip and execute reset-start host transmits h'00 data continuously at prescribed bit rate chip measures low period of h'00 data transmitted by host chip calculates bit rate and sets value in bit rate register chip transfers user program to ram * 2 chip calculates remaining bytes to be transferred (n = n ? 1) * 2 after receiving h'55, chip transfers part of boot program to ram after bit rate adjustment, chip transmits one h'00 data byte to host to indicate end of adjustment host confirms normal reception of bit rate adjustment end indication, and transmits one h'55 data byte after confirming that all flash memory data is h'ff, chip transmits one h'aa byte to host erase all flash memory blocks * 3 chip receives, as 2 bytes, number of program bytes (n) to be transferred to on-chip ram * 1 chip branches to ram boot area (h'fc00 to h'ff2f), then checks flash memory user area data chip transfers user program to ram, then transmits one h'aa byte to host chip branches to ram area address h'fbe0 and executes user program transferred to ram start no yes yes no all data = h'ff? 10 8 3 9 7 6 5 4 1 2 1. set the chip to boot mode and execute a reset-start. 2. set the host to the prescribed bit rate (2400/4800/9600) and have it transmit h'00 data continuously using a transfer data format of 8-bit data plus 1 stop bit. 3. the chip repeatedly measures the low period at the rxd pin and calculates the asynchronous communication bit rate used by the host. 4. after sci3 bit rate adjustment is completed, the chip transmits one h'00 data byte to indicate the end of adjustment. 5. on receiving the one-byte data indicating completion of bit rate adjustment, the host should confirm normal reception of this indication and transmit one h'55 data byte. 6. after receiving h'55, the chip transfers part of the boot program to ram areas h'fb80 to h'fbdf and h'fc00 to h'ff2f. 7. the chip branches to the ram boot program area (h'fc00?h'ff2f) and checks for the presence of data written in the flash memory. if data has been written in the flash memory, the chip erases all blocks. 8. the chip transmits one h'aa byte. the host then transmits the number of user program bytes to be transferred to the chip. the number of bytes should be sent as two bytes, upper byte followed by lower byte. the host should then transmit sequentially the program set by the user. the chip transmits the received byte count and user program sequentially to the host, one byte at a time, as verify data (echo-back). 9. the chip writes the received user program sequentially to on-chip ram area h'fbe0 to h'ff6d (910 bytes). 10. the chip transmits one h'aa byte, then branches to on- chip ram address h'fbe0 and executes the user program written in area h'fbe0 to h'ff6d. notes: 1. the size of the ram area available to the user is 910 bytes. the number of bytes to be transferred must not exceed 910 bytes. the transfer byte count must be sent as two bytes, upper byte followed by lower byte. example of transfer byte count: for 256 bytes (h'0100), upper byte = h'01, lower byte = h'00 2. the part of the user program that controls the flash memory should be set in the program in accordance with the flash memory program/ erase algorithms described later in this section. 3. if a memory cell does not operate normally and cannot be erased, the chip transmits one h'ff byte as an erase error indication and halts the erase operation and subsequent operations. transfer end byte count n = 0? figure 6.9 boot mode operation flowchart
section 6 rom rev. 6.00 sep 12, 2006 page 122 of 526 rej09b0326-0600 automatic sci bit rate adjustment: when boot mode is initiated, the h8/3644f, h8/3643f, or h8/3642af measures the low period of the asynchronous sci communication data transmitted continuously from the host (figure 6.10). the data format should be set as 8-bit data, 1 stop bit, no parity. the chip calculates the bit rate of the transmission from the host from the measured low period (9 bits), and transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication has been received normally, and transmit one h'55 byte to the chip. if reception cannot be performed normally, initiate boot mode again (reset), and repeat the above operations. depending on the host?s transmission bit rate and the chip?s system clock oscillation frequency (f osc ), there will be a discrepancy between the bit rates of the host and the chip. to insure correct sci operation, the host?s transfer bit rate should be set to 2400, 4800, or 9600 bps * 1 . table 6.10 shows typical host transfer bit rates and system clock oscillation frequency for which automatic adjustment of the chip?s bit rate is possible. boot mode should be used within this system clock oscillation frequency range * 2 . notes: 1. only use a host bit rate setting of 2400, 4800, or 9600 bps. no other bit rate setting should be used. 2. although the chip may also perform automatic bit rate adjustment with bit rate and system clock oscillation frequency combinations other than those shown in table 6.10, a degree of error will arise between the bit rates of the host and the chip, and subsequent transfer will not be performed normally. therefore, only a combination of bit rate and system clock oscillation frequency within one of the ranges shown in table 6.10 can be used for boot mode execution. start bit d0 d1 d2 d3 d4 d5 d6 d7 stop bit low period (9 bits) measured (h'00 data) high period (1 or more bits) figure 6.10 measurement of low period in transmit data from host
section 6 rom rev. 6.00 sep 12, 2006 page 123 of 526 rej09b0326-0600 table 6.10 system clock oscillation frequencies permitting automatic adjustment of chip (h8/3644f, h8/3643f, h8/3642af) bit rate host bit rate * system clock oscillation frequencies (f osc ) permitting automatic adjustment of chip (h8/3644f, h8/3643f, h8/3642af) bit rate 9600 bps 8 mhz to 16 mhz 4800 bps 4 mhz to 16 mhz 2400 bps 2 mhz to 16 mhz note: * use a host bit rate setting of 2400, 4800, or 9600 bps only. no other setting should be used. ram area allocation in boot mode: in boot mode, the 96-byte area from h'fb80 to h'fbdf and the 18-byte area from h'ff6e to h'ff7f are reserved for boot program use, as shown in figure 6.11. the area to which the user program is transferred is h'fbe0 to h'ff6d (910 bytes). the boot program area becomes available when a transition is made to the execution state for the user program transferred to ram. a stack area should be set within the user program as required. h'ff6e h'ff7f h'fb80 boot program area * (96 bytes) boot program area * (18 bytes) user program transfer area (910 bytes) h'fbe0 these areas cannot be used until a transition is made to the execution state for the user program transferred to ram (i.e. a branch is made to ram address h'fbe0). note also that the boot program remains in the boot program area in ram (h'fb80 to h'fbdf, h'ff6e to h'ff7f) even after control branches to the user program. when an interrupt handling routine is executed in the boot program, the 16 bytes from h'fb80 to h'fb8f in this area cannot be used. for details see section 6.7.9, interrupt handling during flash memory programming/erasing. note: * figure 6.11 ram areas in boot mode
section 6 rom rev. 6.00 sep 12, 2006 page 124 of 526 rej09b0326-0600 notes on use of boot mode: 1. when the chip (h8/3644f, h8/3643f, or h8/3642af) comes out of reset in boot mode, it measures the low period of the input at the sci3?s rxd pin. the reset should end with rxd high. after the reset ends, it takes about 100 states for the chip to get ready to measure the low period of the rxd input. 2. in boot mode, if any data has been programmed into the flash memory (if all data is not h'ff), all flash memory blocks are erased. boot mode is for use when user program mode is unavailable, such as the first time on-board programming is performed, or if the program activated in user program mode is accidentally erased. 3. interrupts cannot be used while the flash memory is being programmed or erased. 4. the rxd and txd lines should be pulled up on the board. 5. before branching to the user program (ram address h'fbe0), the chip terminates transmit and receive operations by its on-chip sci3 (by clearing the re and te bits to 0 in the serial control register (scr)), but the adjusted bit rate value remains set in the bit rate register (brr). the transmit data output pin, txd, goes to the high-level output state (pcr2 2 = 1 in the port 2 control register, p2 2 = 1 in the port 2 data register). the contents of the cpu?s internal general registers are undefined at this time, so these registers must be initialized immediately after branching to the user program. in particular, since the stack pointer (sp) is used implicitly in subroutine calls, etc., a stack area must be specified for use by the user program. the initial values of other on-chip registers are not changed. 6. boot mode can be entered by applying 12 v to the test pin and fv pp pin in accordance with the mode setting conditions shown in table 6.9, and then executing a reset-start. care must be taken with turn-on of the v pp power supply at this time. on reset release (a low-to-high transition), the chip determines whether 12 v is being applied to the test pin and fv pp pin, and on detecting that boot mode has been set, retains that state internally. as the applied voltage criterion level (threshold level) at this time is the range of approximately v cc +2 v to 11.4 v, a transition will be made to boot mode even if a voltage sufficient for executing programming and erasing (11.4 v to 12.6 v) is not being applied. therefore, when executing the boot program, the v pp power supply must be stabilized within the range of 11.4 v to 12.6 v before a branch is made to the ram area, as shown in figure 6.22. insure that the program voltage v pp does not exceed 12.6 v when a transition is made to boot mode (when reset is released), and does not exceed the range 12 v 0.6 v during boot mode operation. if these values are exceeded, boot mode execution will not be performed correctly. also, do not release or cut v pp during boot mode execution or when programming or erasing flash memory*.
section 6 rom rev. 6.00 sep 12, 2006 page 125 of 526 rej09b0326-0600 boot mode can be exited by driving the reset pin low, then releasing 12 v application to the test pin and fv pp pin at least 10 system clock cycles later, and setting the test pin to v ss to release the reset. however, external pin settings must not be changed during boot mode execution. note that the boot mode state is not maintained if 12 v application to the test pin is released while in boot mode. also, if a watchdog timer reset occurs in this boot mode state, the built-in boot program will be restarted without clearing the mcu?s internal mode state. 7. if the test pin input level is changed (e.g. from 0 v to 5 v to 12 v) during a reset (while a low level is being input at the res pin), port states will change as a result of the change of mcu operating mode. therefore, care must be taken to make pin settings to prevent these pins from becoming output signal pins during a reset, and to prevent collision with signals outside the mcu. 8. regarding 12 v application to the fv pp and test pins, insure that peak overshoot does not exceed the maximum rating of 13 v. also, be sure to connect bypass capacitors to the fv pp and test pins. note: * for further information on v pp application, release, and cut-off, see note 5 in section 6.9, flash memory programming and erasing precautions. 6.6.2 user program mode when set to user program mode, the h8/3644f, h8/3643f, or h8/3642af can program and erase its flash memory by executing a user program. therefore, on-board reprogramming of the on-chip flash memory can be carried out by providing on-board means of supplying v pp and programming data, and storing an on-board reprogramming program in part of the program area. user program mode is selected by applying 12 v to the fv pp pin when flash memory is not being accessed, during a reset or after confirming that a reset has been performed properly (after the reset is released). the flash memory cannot be read while being programmed or erased, so the on-board reprogramming program or flash memory reprogramming routine should be transferred to the ram area, and on-board reprogramming executed in that area.
section 6 rom rev. 6.00 sep 12, 2006 page 126 of 526 rej09b0326-0600 user program mode execution procedure * 1 : the procedure for user program execution in ram is shown below. reset-start (test = v ss ) branch to flash memory on-board reprogramming program transfer flash memory reprogramming routine to ram branch to flash memory reprogramming routine in ram area fv pp = 12 v (user program mode) execute flash memory reprogramming routine in ram area (flash memory reprogramming) release fv pp (exit user program mode) branch to flash memory application program * 2 1 2 3 4 5 6 7 8 procedure: an on-board reprogramming program must be written into flash memory by the user beforehand. 1. set the test pin to v ss and execute a reset-start. 2. branch to the on-board reprogramming program written to flash memory. 3. transfer the flash memory reprogramming routine to the ram area. 4. branch to the flash memory reprogramming routine transferred to the ram area. 5. apply 12 v to the fv pp pin. (transition to user program mode) 6. execute the flash memory reprogramming routine in the ram area, an perform on-board reprogramming of the flash memory. 7. switch the fv pp pin from 12 v to v cc , and exit user program mode. 8. after on-board reprogramming of the flash memory ends, branch to the flash memory application program. notes: 1. do not apply 12 v to the fv pp pin during normal operation. to prevent inadvertent programming or erasing due to program runaway, etc., apply 12 v to the fv pp pin only when the flash memory is being programmed or erased . memory cells may not operate normally if overprogrammed or overerased due to program runaway, etc. also, while 12 v is applied to the fv pp pin, the watchdog timer should be activated to prevent overprogramming or overerasing due to program runaway, etc. for further information on fv pp application, release, and cut-off, see note 5 in section 6.9, flash memory programming and erasing precautions. 2. when the application of 12 v to the fv pp pin is released after programming is completed, the flash memory read setup time (t frs ) must elapse before executing a program in flash memory. this specifies the setup time from the point at which the fv pp voltage reaches the v cc + 2 v level after 12 v application is released until the flash memory is read. figure 6.12 example of user program mode operation
section 6 rom rev. 6.00 sep 12, 2006 page 127 of 526 rej09b0326-0600 6.7 programming and erasing flash memory the on-chip flash memory of the h8/3644f, h8/3643f, and h8/3642af is programmed and erased by software, using the cpu. there are five flash memory operating modes: program mode, erase mode, program-verify mode, erase-verify mode, and prewrite-verify mode. transitions to these modes can be made by setting the p, e, pv, and ev bits in the flash memory control register (flmcr). the flash memory cannot be read while being programmed or erased. therefore, the program that controls flash memory programming and erasing should be located and executed in on-chip ram or external memory. a description of each mode is given below, with recommended flowcharts and sample programs for programming and erasing. see section 6.9, flash memory programming and erasing precautions, for additional notes on programming and erasing. 6.7.1 program mode to write data into the flash memory, follow the programming algorithm shown in figure 6.13. this programming algorithm enables data to be written without subjecting the device to voltage stress or impairing the reliability of the programmed data. to write data, first set the blocks to be programmed with erase block registers 1 and 2 (ebr1, ebr2), and write the data to the address to be programmed, as in writing to ram. the flash memory latches the programming address and programming data in an address latch and data latch. next set the p bit in flmcr, selecting program mode. the programming time is the time during which the p bit is set. make a setting so that the total programming time does not exceed 1 ms. programming for too long a time, due to program runaway for example, can damage the device. before selecting program mode, set up the watchdog timer so as to prevent overprogramming. for details of the programming procedure, see section 6.7.3, programming flowchart and sample program.
section 6 rom rev. 6.00 sep 12, 2006 page 128 of 526 rej09b0326-0600 6.7.2 program-verify mode in program-verify mode, the data written in program mode is read to check whether it has been correctly written in the flash memory. after the elapse of the programming time, exit programming mode (clear the p bit to 0) and select program-verify mode (set the pv bit to 1). in program-verify mode, a program-verify voltage is applied to the memory cells at the latched address. if the flash memory is read in this state, the data at the latched address will be read. after selecting program-verify mode, wait at least 4 s before reading, then compare the programmed data with the verify data. if they agree, exit program-verify mode and program the next address. if they do not agree, select program mode again and repeat the same program and program-verify sequence. do not repeat the program and program-verify sequence more than six times* for the same bit. note: * when a bit is programmed repeatedly, set a loop counter so that the total programming time will not exceed 1 ms.
section 6 rom rev. 6.00 sep 12, 2006 page 129 of 526 rej09b0326-0600 6.7.3 programming flowchart and sample program flowchart for programming one byte start end (1-byte data programmed) programming error set erase block register (set bit for block to be programmed to 1) select program mode (p bit = 1 in flmcr) n = 1 wait (x) s * 4 clear p bit end of programming end of verify no ng ok yes enable watchdog timer * 2 disable watchdog timer select program-verify mode (pv bit = 1 in flmcr) wait (t vs1 ) s * 5 clear pv bit clear pv bit n + 1 n double the programming time (x 2 x) clear erase block register (clear bit for programmed block to 0) write data to flash memory (flash memory latches write address and data) * 1 verify * 3 (read memory) n n? * 5 notes: 1. write the data to be programmed using a byte transfer instruction. 2. for the timer overflow interval, set the timer counter value (tcw) to h'fe. 3. read the memory data to be verified using a byte transfer instruction. 4. programming time x is successively incremented to initial set value 2 n ? 1 (n = 1 to 6). the initial value should therefore be set to 15.8 s or less to make the total programming time 1 ms or less. 5. t vs1 : 4 s or more n: 6 (set n so that total programming time does not exceed 1 ms) figure 6.13 programming flowchart
section 6 rom rev. 6.00 sep 12, 2006 page 130 of 526 rej09b0326-0600 sample program for programming one byte this program uses the following registers: r0h: used for erase block specification. r1h: stores programming data. r1l: stores read data. r3: stores the programming address. valid address specifications are h'0000 to h'ef7f. r4: used for program and program-verify loop counter value setting. also stores register set values. r5: used for program loop counter value setting. r6l: used for the program-verify fail count. arbitrary data can be programmed at an arbitrary address by setting the r3 (programming address) and r1h (programming data) values. the values of #a and #b depend on the operating frequency. they should be set as indicated in table 6.11. flmcr: .equ h'ff80 ebr1: .equ h'ff82 ebr2: .equ h'ff83 tcsrw: .equ h'ffbe tcw: .equ h'ffbf .align 2 prgm: mov.b #h'**, r0h ; mov.b r0h, @ebr*:8 ; set ebr * mov.b #h'00, r6l ; program-verify fail count mov.w #h'a, r5 ; set program loop counter mov.b r1h, @r3 ; dummy write prgms: inc r6l ; program-verify fail counter + 1 r6l mov.w #h'fe5a, r4 ; mov.b r4l, @tcsrw:8 ; mov.b r4h, @tcw:8 ; mov.b #h'36, r4l ; mov.b r4l, @tcsrw:8 ; start watchdog timer mov.w r5, r4 ; set program loop counter
section 6 rom rev. 6.00 sep 12, 2006 page 131 of 526 rej09b0326-0600 bset #0, @flmcr:8 ; set p bit loop1: subs #1, r4 ; mov.w r4, r4 ; bne loop1 ; wait loop bclr #0, @flmcr:8 ; clear p bit mov.b #h'50, r4l ; mov.b r4l, @tcsrw:8 ; stop watchdog timer mov.b #h'b, r4h ; set program-verify fail counter bset #2, @flmcr:8 ; set pv bit loop2: dec r4h ; bne loop2 ; wait loop mov.b @r3, r1l ; read programmed data cmp.b r1h, r1l ; compare programmed data with read data beq pvok ; program-verify decision bclr #2, @flmcr:8 ; clear pv bit cmp.b #h'06, r6l ; program-verify executed 6 times? beq ngend ; if program-verify executed 6 times, branch to ngend add.w r5, r5 ; double programming time bra prgms ; program again pvok: bclr #2, @flmcr:8 ; clear pv bit mov.b #h'00, r6l ; mov.b r6l, @ebr*:8 ; clear ebr * one byte programmed ngend: programming error
section 6 rom rev. 6.00 sep 12, 2006 page 132 of 526 rej09b0326-0600 6.7.4 erase mode to erase the flash memory, follow the erasing algorithm shown in figure 6.14. this erasing algorithm enables data to be erased without subjecting the device to voltage stress or impairing the reliability of the programmed data. to erase flash memory, before starting to erase, first place all memory data in all blocks to be erased in the programmed state (program all memory data to h'00). if all memory data is not in the programmed state, follow the sequence described later to program the memory data to zero. select the flash memory areas to be programmed with erase block registers 1 and 2 (ebr1, ebr2). next set the e bit in flmcr, selecting erase mode. the erase time is the time during which the e bit is set. to prevent overerasing, use a software timer to divide the time for one erasure, and insure that the total time does not exceed 30 s. see section 6.7.6, erase flowcharts and sample programs, for the time for one erasure. overerasing, due to program runaway for example, can give memory cells a negative threshold voltage and cause them to operate incorrectly. before selecting erase mode, set up the watchdog timer so as to prevent overerasing. 6.7.5 erase-verify mode in erase-verify mode, after data has been erased, it is read to check that it has been erased correctly. after the erase time has elapsed, exit erase mode (clear the e bit to 0), and select erase- verify mode (set the ev bit to 1). before reading data in erase-verify mode, write h'ff dummy data to the address to be read. this dummy write applies an erase-verify voltage to the memory cells at the latched address. if the flash memory is read in this state, the data at the latched address will be read. after the dummy write, wait at least 2 s before reading. also, wait at least 4 s before performing the first dummy write after selecting erase-verify mode. if the read data has been successfully erased, perform the erase-verify sequence (dummy write, wait of at least 2 s, read) on the next address. if the read data has not been erased, select erase mode again and repeat the same erase and erase-verify sequence through the last address, until all memory data has been erased to 1. do not repeat the erase and erase-verify sequence more than 602 times, however.
section 6 rom rev. 6.00 sep 12, 2006 page 133 of 526 rej09b0326-0600 6.7.6 erase flowcharts and sample programs flowchart for erasing one block start end of erase erase error set erase block register (set bit for block to be erased to 1) write 0 data in all addresses to be erased (prewrite) * 1 select erase mode (e bit = 1 in flmcr) n = 1 wait (x) ms * 5 clear e bit erasing halts end of erase-verify no no ng no ok yes yes yes enable watchdog timer * 2 disable watchdog timer select erase-verify mode (ev bit = 1) dummy write to verify address * 3 (flash memory latches address) set block start address as verify address wait (t vs1 ) s * 6 wait (t vs2 ) s * 6 clear ev bit address + 1 address clear ev bit n + 1 n double the erase time (x 2 x) clear erase block register (clear bit for erased block to 0) verify * 4 (read data h'ff?) last address? n n? * 6 n > 4? notes: 1. program all addresses to be erased by following the prewrite flowchart. 2. set the watchdog timer overflow interval to the initial value shown in table 6.12. 3. for the erase-verify dummy write, write h'ff using a byte transfer instruction. 4. for the erase-verify operation, read the data using a byte transfer instruction. when erasing multiple blocks, clear the erase block register bits for erased blocks and perform additional erasing only for unerased blocks. 5. erase time x is successively incremented to initial set value x 2n-1 (n = 1 to 4), and is fixed from the 4th time onward. an initial value of 6.25 ms or less should be set, and the time for one erasure should be 50 ms or less. 6. t vs1 : 4 s or more t vs2 : 2 s or more n: 602 (set n so that the total erase time does not exceed 30 s) figure 6.14 erase flowchart
section 6 rom rev. 6.00 sep 12, 2006 page 134 of 526 rej09b0326-0600 prewrite flowchart start end of prewrite programming error set erase block register (set bit for block to be programmed to 1) select program mode (p bit = 1 in flmcr) set start address * 6 n = 1 wait (x) s * 4 clear p bit end of programming no no ng ok yes yes enable watchdog timer * 2 disable watchdog timer wait (t vs1 ) s * 5 n + 1 n address + 1 address double the programming time (x 2 x) clear erase block register (clear bit for programmed block to 0) write h'00 to flash memory (flash memory latches programmed address and data) * 1 prewrite verify * 3 (read data h'00?) n n? * 5 last address? notes: 1. write using a byte transfer instruction. 2. for the timer overflow interval, set the timer counter value (tcw) to h'fe. 3. in prewrite-verify mode, p, e, pv, and ev are all cleared to 0, and 12 v is applied to the v pp pin. read using a byte transfer 4. programming time x is successively incremented to initial set value 2 n ? 1 (n = 1 to 6). the initial value should therefore be set to 15.8 s or less to make the total programming time 1 ms or less. 5. t vs1 : 4 s or more n: 6 (set n so that the total programming time does not exceed 1 ms) 6. the start address and last address are the start address and last address of the block to be erased. * 6 figure 6.15 prewrite flowchart
section 6 rom rev. 6.00 sep 12, 2006 page 135 of 526 rej09b0326-0600 sample program for erasing one block this program uses the following registers: r0: used for erase block specification. also stores address used in prewrite and erase-verify. r1h: stores read data. also used in dummy write. r2: stores last address of block to be erased. r3: stores address used in prewrite and erase-verify. r4: used for prewrite, prewrite-verify, erase, and erase-verify loop counter value setting. also stores register set values. r5: used for prewrite and erase loop counter value setting. r6l: used for prewrite-verify and erase-verify fail count. the values of #a, #b, #c, #d, and #e in the program depend on the operating frequency. they should be set as indicated in tables 6.11 and 6.12. erase block register (ebr1, ebr2) settings should be made as indicated in sections 6.5.2 and 6.5.3 in section 6.5, flash memory register descriptions. for #blkstr and #blkend, the start address and end address corresponding to the set erase block register should be set as indicated in table 6.7. flmcr: .equ h'ff80 ebr1: .equ h'ff82 ebr2: .equ h'ff83 tcsrw: .equ h'ffbe tcw: .equ h'ffbf .align 2 mov.b #h'**, r0h ; mov.b r0h, @ebr*:8 ; set ebr * ; # blkstr is start address of block to be erased ; # blkend is last address of block to be erased mov.w #blkstr, r0 ; start address of block to be erased mov.w #blkend, r2 ; last address of block to be erased adds #1, r2 ; last address of block to be erased + 1 r2 ; execute prewrite mov.w r0, r3 ; start address of block to be erased
section 6 rom rev. 6.00 sep 12, 2006 page 136 of 526 rej09b0326-0600 prewrt: mov.b #h'00, r6l ; prewrite verify fail counter mov.w #h'a, r5 ; set prewrite loop counter prewrs: inc r6l ; prewrite-vector fail counter + 1 r6l mov.b #h'00, r1h ; mov.b r1h, @r3 ; write h'00 mov.w #h'fe5a, r4 ; mov.b r4l, @tcsrw:8 ; mov.b r4h, @tcw:8 ; mov.b #h'36, r4l ; mov.b r4l, @tcsrw:8 ; start watchdog timer mov.w r5, r4 ; set prewrite loop counter bset #0, @flmcr:8 ; set p bit loopr1: subs #1, r4 ; mov.w r4, r4 ; bne loopr1 ; wait loop bclr #0, @flmcr:8 ; clear p bit mov.b #h'50, r4l ; mov.b r4l, @tcsrw:8 ; stop watchdog timer mov.b #h'c, r4h ; set prewrite-verify loop counter loopr2: dec r4h ; bne loopr2 ; wait loop mov.b @r3, r1h ; read data = h'00? beq pwvfok ; if read data = h'00, branch to pwvfok cmp.b #h'06, r6l ; prewrite-verify executed 6 times? beq abend1 ; if prewrite-verify executed 6 times, branch to abend1 add.w r5, r5 ; double the programming time bra prewrs ; prewrite again abend1: write error pwvfok: adds #1, r3 ; address + 1 r3 cmp.w r2, r3 ; last address? bne prewrt ; if not last address, prewrite next address ; execute erase
section 6 rom rev. 6.00 sep 12, 2006 page 137 of 526 rej09b0326-0600 erases: mov.w #h'0000, r6 ; erase-verify fail counter mov.w #h'd, r5 ; set erase loop counter erase: adds #1, r6 ; erase-verify fail counter + 1 r6 mov.w #h'e5a, r4 ; mov.b r4l, @tcsrw:8 ; mov.b r4h, @tcw:8 ; mov.b #h'36, r4l ; mov.b r4l, @tcsrw:8 ; start watchdog timer mov.w r5, r4 ; set erase loop counter bset #1, @flmcr:8 ; set e bit loope: nop nop nop nop subs #1, r4 ; mov.w r4, r4 ; bne loope ; wait loop bclr #1, @flmcr:8 ; clear e bit mov.b #h'50, r4l ; mov.b r4l, @tcsrw:8 ; stop watchdog timer ; execute erase-verify mov.w r0, r3 ; start address of block to be erased mov.b #h'b, r4h ; set erase-verify loop counter bset #3, @flmcr:8 ; set ev bit loopev: dec r4h ; bne loopev ; wait loop evr2: mov.b #h'ff, r1h ; mov.b r1h, @r3 ; dummy write mov.b #h'c, r4h ; set erase-verify loop counter loopdw: dec r4h ; bne loopdw ; wait loop mov.b @r3+, r1h ; read cmp.b #h'ff, r1h ; read data = h'ff? bne rerase ; if read data h'ff, branch to rerase
section 6 rom rev. 6.00 sep 12, 2006 page 138 of 526 rej09b0326-0600 cmp.w r2, r3 ; last address in block? bne evr2 ; bra okend ; rerase: bclr #3, @flmcr:8 ; clear ev bit subs #1, r3 ; erase-verify address ? 1 r3 mov.w #h'0004, r4 ; cmp.w r4, r6 ; erase-verify fail count = 4? bpl brer ; if r6 4. branch to brer (branch until r6 = 4 ? 602) add.w r5, r5 ; if r6 < 4, double erase time (executed only for r6 = 1, 2, 3) brer: mov.w #h'025a, r4 ; cmp.w r4, r6 ; erase-verify executed 602 times? bne erase ; if erase-verify not executed 602 times, erase again bra abend2 ; if erase-verify executed 602 times, branch to abend2 okend: bclr #3, @flmcr:8 ; clear ev bit mov.b #h'00, r6l ; mov.b r6l, @ebr*:8 ; clear ebr * one block erased abend2: erase error
section 6 rom rev. 6.00 sep 12, 2006 page 139 of 526 rej09b0326-0600 flowchart for erasing multiple blocks start end of erase erase error set erase block register (set bit for block to be erased to 1) write 0 data in all addresses to be erased (prewrite) * 1 select erase mode (e bit = 1 in flmcr) n = 1 wait (x) ms * 5 clear e bit erasing halts no no no ng no no no ok yes yes yes yes yes yes enable watchdog timer * 2 disable watchdog timer wait (t vs1 ) s * 6 dummy write to verify address * 3 (flash memory latches address) set block start address as verify address erase-verify next block select erase-verify mode (ev bit = 1 in flmcr) wait (t vs2 ) s * 6 clear ebr bit for erase block clear ev bit address + 1 address n + 1 n erase-verify next block double the erase time (x 2 x) verify * 4 (read data h'ff?) last address of block? erase-verify completed for all erase blocks? erase-verify completed for all erase blocks? all erase blocks erased? (ebr1 = ebr2 = 0?) n n? * 6 n 4? notes: 1. program all addresses to be erased by following the prewrite flowchart. 2. set the timer overflow interval to the initial value shown in table 6.13. 3. for the erase-verify dummy write, write h'ff using a byte transfer instruction. 4. for the erase-verify operation, read the data using a byte transfer instruction. when erasing multiple blocks, clear the erase block register bits for erased blocks and perform additional erasing only for unerased blocks. 5. erase time x is successively incremented to initial set value 2 n ? 1 (n = 1 to 4), and is fixed from the 4th time onward. an initial value of 6.25 ms or less should be set, and the time for one erasure should be 50 ms or less. 6. t vs1 : 4 s or more t vs2 : 2 s or more n: 602 (set n so that the total erase time does not exceed 30 s) figure 6.16 multiple-block erase flowchart
section 6 rom rev. 6.00 sep 12, 2006 page 140 of 526 rej09b0326-0600 sample program for erasing multiple blocks this program uses the following registers: r0: used for erase block specification (set as explained below). also stores address used in prewrite and erase-verify. r1h: used to test bits 8 to 11 of r0. stores read data; used in dummy write. r1l: used to test bits 0 to 11 of r0. r2: specifies address where address used in prewrite and erase-verify is stored. r3: stores address used in prewrite and erase-verify. r4: stores last address of block to be erased. r5: used for prewrite and erase loop counter value setting. r6l: used for prewrite-verify and erase-verify fail count. arbitrary blocks can be erased by setting bits in r0. r0 settings should be made by writing with a word transfer instruction. a bit map of r0 and a sample setting for erasing specific blocks are shown below. bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 r0 ? ? ? ? lb3 lb2 lb1 lb0 sb7 sb6 sb5 sb4 sb3 sb2 sb1 sb0 corresponds to ebr1 corresponds to ebr2 note: bits 15 to 12 should be cleared to 0. example: to erase blocks lb2, sb7, and sb0 bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 r0 ? ? ? ? lb3 lb2 lb1 lb0 sb7 sb6 sb5 sb4 sb3 sb2 sb1 sb0 corresponds to ebr1 corresponds to ebr2 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 r0 is set as follows: mov.w #h'0481, r0 mov.b r0h, @ebr1 mov.b r0l, @ebr2 the values of #a, #b, #c, #d, and #e in the program depend on the operating frequency. they should be set as indicated in tables 6.11 and 6.12.
section 6 rom rev. 6.00 sep 12, 2006 page 141 of 526 rej09b0326-0600 notes: 1. in this sample program, the stack pointer (sp) is set to address h'ff80. on-chip ram addresses h'ff7e and h'ff7f are used as a stack area. therefore addresses h'ff7e and h'ff7f should not be used when this program is executed, and on-chip ram should not be disabled. 2. it is assumed that this program, written in the rom area, is transferred to the ram area and executed there. for #ramstr in the program, substitute the start address of the ram area to which the program is transferred. the value set for #ramstr must be an even number. flmcr: .equ h'ff80 ebr1: .equ h'ff82 ebr2: .equ h'ff83 tcsrw: .equ h'ffbe tcw: .equ h'ffbf stack: .equ h'ff80 .align 2 start: mov.w #stack, sp ; set stack pointer ; set r0 value as explained on previous page. this sample program erases ; all blocks. mov.w #h'0fff, r0 ; select blocks to be erased (r0: ebr1/ebr2) mov.b r0h, @ebr1 ; set ebr1 mov.b r0l, @ebr2 ; set ebr2 ; #ramstr is start address of ram area to which program is transferred ; set #ramstr to even number mov.w #ramstr, r2 ; transfer destination start address (ram) mov.w #ervadr, r3 ; add.w r3, r2 ; #ramstr + #ervadr r2 mov.w #start, r3 ; sub.w r3, r2 ; address of data area used in ram mov.b #h'00, r1l ; used to test bit r1l in r0 pretst: cmp.b #h'0c, r1l ; r1l = h'0c? beq erases ; if finished checking all r0 bits, branch to erases cmp.b #h'08, r1l ; bmi ebr2pw ; if r1l 8, ebr1 test; if r1l < 8, ebr2 test mov.b r1l, r1h ; subx #h'08, r1h ; r1l ? 8 r1h btst r1h, r0h ; test bit r1h in ebr1 (r0h ) bne prewrt ; if bit r1h in ebr1 (r0h) is 1, branch to prewrt bra pwadd1 ; if bit r1h in ebr1 (r0h) is 0, branch to pwadd1 ebr2pw: btst r1l, r0l ; test bit r1l in ebr2 (r0l) bne prewrt ; if bit r1l in ebr2 (r0l) is 1, branch to prewrt pwadd1: inc r1l ; r1l + 1 r1l
section 6 rom rev. 6.00 sep 12, 2006 page 142 of 526 rej09b0326-0600 mov.w @r2+, r3 ; dummy-increment r2 bra pretst ; ; execute prewrite prewrt: mov.w @r2+, r3 ; prewrite start address prew: mov.b #h'00, r6l ; prewrite-verify fail counter mov.w #h'a, r5 ; set prewrite loop counter prewrs: inc r6l ; prewrite-verify fail counter + 1 r6h mov.b #h'00 r1h ; mov.b r1h, @r3 ; write h'00 mov.w #h'fe5a, r4 ; mov.b r4l, @tcsrw:8 ; mov.b r4h, @tcw:8 ; mov.b #h'36, r4l ; mov.b r4l, @tcsrw:8 ; start watchdog timer mov.w r5, r4 ; set prewrite loop counter bset #0, @flmcr:8 ; set p bit loopr1: subs #1, r4 ; mov.w r4, r4 ; bne loopr1 ; wait loop bclr #0, @flmcr:8 ; clear p bit mov.b #h'50, r4l ; mov.b r4l, @tcsrw:8 ; stop watchdog timer mov.b #h'b, r4h ; set prewrite-verify loop counter loopr2: dec r4h ; bne loopr2 ; wait loop mov.b @r3, r1h ; read data = h'00? beq pwvfok ; if read data = h'00, branch to pwvfok cmp.b #h'06, r6l ; prewrite-verify executed 6 times? beq abend1 ; if prewrite-verify executed 6 times, branch to abend1 add.w r5, r5 ; double the programming time bra prewrs ; prewrite again abend1: write error pwvfok: adds #1, r3 ; address + 1 r3 mov.w @r2, r4 ; start address of next block cmp.w r4, r3 ; last address? bne prew ; if not last address, prewrite next address pwadd2: inc r1l ; used to test bit r1l +1 in r0 bra pretst ; branch to pretst ; execute erase erases: mov.w #h'0000, r6 ; erase-verify fail counter mov.w #h'd, r5 ; set erase loop counter erase: adds #1, r6 ; erase-verify fail counter + 1 r6
section 6 rom rev. 6.00 sep 12, 2006 page 143 of 526 rej09b0326-0600 mov.w #h'e5a, r4 ; mov.b r4l, @tcsrw:8 ; mov.b r4h, @tcw:8 ; mov.b #h'36, r4l ; mov.b r4l, @tcsrw:8 ; start watchdog timer mov.w r5, r4 ; set erase loop counter bset #1, @flmcr:8 ; set e bit loope: nop nop nop nop subs #1, r4 ; mov.w r4, r4 ; bne loope ; wait loop bclr #1, @flmcr:8 ; clear e bit mov.b #h'50, r4l ; mov.b r4l, @tcsrw:8 ; stop watchdog timer ; execute erase-verify evr: mov.w #ramstr, r2 ; transfer destination start address (ram) mov.w #ervadr, r3 ; add.w r3, r2 ; #ramstr + #ervadr r2 mov.w #start, r3 ; sub.w r3, r2 ; address of data area used in ram mov.b #h'00, r1l ; used to test bit r1l in r0 mov.b #h'b, r4h ; set erase-verify loop counter bset #3, @flmcr:8 ; set ev bit loopev: dec r4h ; bne loopev ; wait loop ebrtst: cmp.b #h'0c, r1l ; r1l = h'0c? beq hantei ; if finished checking all r0 bits, branch to hantei cmp.b #h'08, r1l ; bmi ebr2ev ; if r1l 8, ebr1 test; if r1l < 8, ebr2 test mov.b r1l, r1h ; subx #h'08, r1h ; r1l ? 8 r1h btst r1h, r0h ; test bit r1h in ebr1 (r0h) bne ersevf ; if bit r1h in ebr1 (r0h) is 1, branch to ersevf bra add01 ; if bit r1h in ebr1 (r0h) is 0, branch to add01 ebr2ev: btst r1l, r0l ; test bit r1l in ebr2 (r0l) bne ersevf ; if bit r1l in ebr2 (r0l) is 1, branch to ersevf add01: inc r1l ; r1l + 1 r1l mov.w @r2+, r3 ; dummy-increment r2 bra ebrtst ; erase1: bra erase ; branch to erase via erase1 ersevf: mov.w @r2+, r3 ; start address of block to be erase-verified
section 6 rom rev. 6.00 sep 12, 2006 page 144 of 526 rej09b0326-0600 evr2: mov.b #h'ff, r1h ; mov.b r1h, @r3 ; dummy write mov.b #h'c, r4h ; set erase-verify loop counter loopep: dec r4h ; bne loopep ; wait loop mov.b @r3+, r1h ; read cmp.b #h'ff, r1h ; read data = h'ff? bne blkad ; if read data h'ff, branch to blkad mov.w @r2, r4 ; start address of next block cmp.w r4, r3 ; last address in block? bne evr2 ; cmp.b #h'08, r1l ; bmi sbclr ; if r1l 8, ebr1 test; if r1l < 8, ebr2 test mov.b r1l, r1h ; subx #h'08, r1h ; r1l ? 8 r1h bclr r1h, r0h ; clear bit r1h in ebr1 (r0h) bra blkad ; sbclr: bclr r1l, r0l ; clear bit r1l in ebr2 (r0l) blkad: inc r1l ; r1l + 1 r1l bra ebrtst ; hantei: bclr #3, @flmcr:8 ; clear ev bit mov.b r0h, @ebr1:8 ; mov.b r0l, @ebr2:8 ; mov.w r0, r4 ; beq eowari ; if ebr1/ebr2 = all 0s, normal end of erase mov.w #h'0004, r4 ; cmp.w r4, r6 ; erase-verify fail count = 4? bpl brer ; if r6 4. branch to brer (branch until r6 = 4 ? 602) add.w r5, r5 ; if r6 < 4, double erase time (executed only for r6 = 1, 2, 3) brer: mov.w #h'025a, r4 ; cmp.w r4, r6 ; erase-verify executed 602 times? bne erase1 ; if erase-verify not executed 602 times, erase again bra abend2 ; if erase-verify executed 602 times, branch to abend2 ;**** < block address table used in erase-verify > **** .align 2 ervadr: .data.w h'0000 ; sb0 .data.w h'0080 ; sb1 .data.w h'0100 ; sb2 .data.w h'0180 ; sb3 .data.w h'0200 ; sb4 .data.w h'0400 ; sb5 .data.w h'0800 ; sb6 .data.w h'0c00 ; sb7 .data.w h'1000 ; lb0
section 6 rom rev. 6.00 sep 12, 2006 page 145 of 526 rej09b0326-0600 .data.w h'2000 ; lb1 .data.w h'4000 ; lb2 .data.w h'6000 ; lb3 .data.w h'8000 ; flash end eowari: ; end of erase abend2: ; erase error loop counter and watchdog timer overflow interval settings in programs: the settings of #a, #b, #c, #d, and #e in the program examples depend on the clock frequency. sample loop counter settings for typical operating frequencies are shown in table 6.11. the value of #e should be set as indicated in table 6.12. as software loops are used, there is intrinsic error, and the calculated value and actual time may not be the same. therefore, initial values should be set so that the total write time does not exceed 1 ms, and the total erase time does not exceed 30 s. the maximum number of writes in the program examples is set as n = 6. write and erase operations as shown in the flowcharts are achieved by setting the values of #a, #b, #c, and #d in the program examples as indicated in table 6.11. use the settings shown in table 6.12 for the value of #e. in these sample programs, wait state insertion is disabled. if wait states are used, the setting should be made after the end of the program. the set value for the watchdog timer (wdt) overflow time is calculated on the basis of the number of instructions including the write time and erase time from the time the watchdog timer is started until it stops. therefore, no other instructions should be added between starting and stopping of the watchdog timer in these programs.
section 6 rom rev. 6.00 sep 12, 2006 page 146 of 526 rej09b0326-0600 table 6.11 set values of #a, #b, #c, and #d for typical operating frequencies when sample program is executed in on-chip memory (ram) oscillation frequency f osc = 16 mhz f osc = 10 mhz f osc = 8 mhz f osc = 2 mhz operating frequency = 8 mhz = 5 mhz = 4 mhz = 1 mhz meaning of variable set time counter set value counter set value counter set value counter set value a ( ) programming time (initial set value) 15.8 s h'000f h'0009 h'0007 h'0001 b ( ) tvs1 4 s h'06 h'04 h'03 h'01 c ( ) tvs2 2 s h'03 h'02 h'01 h'01 d ( ) erase time (initial set value) 6.25 ms h'0c34 h'07a1 h'061a h'0186 formula: if an operating frequency other than those shown in table 6.11 is used, the values can be calculated using the formula shown below. the calculation is based on an operating frequency ( ) of 5 mhz. for a ( ) and d ( ), after decimal calculation, round down the first decimal place and convert to hexadecimal so that a ( ) and d ( ) are 15.8 s or less and 6.25 ms or less, respectively. for b ( ) and c ( ), after decimal calculation, round up the first decimal place and convert to hexadecimal so that b ( ) and c ( ) are 4 s or more and 2 s or more, respectively. operating frequency [mhz] 5 a ( ) to d ( ) = a ( = 5) to d ( = 5)
section 6 rom rev. 6.00 sep 12, 2006 page 147 of 526 rej09b0326-0600 examples: sample calculations when executing a program in on-chip memory (ram) at an operating frequency of 6 mhz a ( ) = 9 = 10.8 10 = h'000a b ( ) = 4 = 4.8 5 = h'05 c ( ) = 2 = 2.4 3 = h'03 d ( ) = 1953 = 2343.6 2343 = h'0927 6 5 6 5 6 5 6 5 table 6.12 watchdog timer overflow interval settings (set value of #e for operating frequencies) oscillation frequency f osc = 16 mhz f osc = 10 mhz f osc = 8 mhz f osc = 2 mhz operating frequency variable = 8 mhz = 5 mhz = 4 mhz = 1 mhz e ( ) h'9b h'df h'e5 h'f7 6.7.7 prewrite-verify mode prewrite-verify mode is a verify mode used to all bits to equalize their threshold voltages before erasure. to program all bits, write h'00 in accordance with the prewrite algorithm shown in figure 6.15. use this procedure to set all data in the flash memory to h'00 after programming. after the necessary programming time has elapsed, exit program mode (by clearing the p bit to 0) and select prewrite-verify mode (leave the p, e, pv, and ev bits all cleared to 0). in prewrite-verify mode, a prewrite-verify voltage is applied to the memory cells at the read address. if the flash memory is read in this state, the data at the read address will be read. after selecting prewrite-verify mode, wait at least 4 s before reading. note: for a sample prewriting program, see the prewrite subroutine in the sample erasing program.
section 6 rom rev. 6.00 sep 12, 2006 page 148 of 526 rej09b0326-0600 6.7.8 protect modes there are two modes for flash memory program/erase protection: hardware protection and software protection. these two protection modes are described below. software protection: with software protection, setting the p or e bit in the flash memory control register (flmcr) does not cause a transition to program mode or erase mode. details of software protection are given below. functions item description program erase verify * block protect programming and erase protection can be set for individual blocks by settings in the erase block registers (ebr1 and ebr2). setting ebr1 to h'f0 and ebr2 to h'00 places all blocks in the program/erase- protected state. disabled disabled enabled note: * three modes: program-verify, erase-verify, and prewrite-verify.
section 6 rom rev. 6.00 sep 12, 2006 page 149 of 526 rej09b0326-0600 hardware protection: hardware protection refers to a state in which programming/erasing of flash memory is forcibly suspended or disabled. at this time, the flash memory control register (flmcr) and erase block register (ebr1 and ebr2) settings are cleared. details of the hardware protection states are given below. functions item description program erase verify * 1 programming voltage (fv pp ) protect when 12 v is not being applied to the fv pp pin, flmcr, ebr1, and ebr2 are initialized, and the program/erase- protected state is entered. to obtain this protection, the v pp voltage should not exceed the v cc power supply voltage. * 3 disabled disabled * 2 disabled reset/standby protect in a reset, (including a watchdog timer reset), and in sleep, subsleep, watch, and standby mode, flmcr, ebr1, and ebr2 are initialized, and the program/erase-protected state is entered. in a reset via the res pin, the reset state is not reliably entered unless the res pin is held low for at least 20 ms (oscillation settling time) * 4 after powering on. in the case of a reset during operation, the res pin must be held low for a minimum of 10 system clock cycles (10 ). disabled disabled * 2 disabled notes: 1. three modes: program-verify, erase-verify, and prewrite-verify. 2. all blocks are erase-disabled, and individual block specification is not possible. 3. for details, see section 6.9, flash memory programming and erasing precautions. 4. for details, see ac characteristics in section 13, electrical characteristics. 6.7.9 interrupt handling during flash memory programming/erasing if an interrupt is generated while the flash memory is being programmed or erased (while the p or e bit is set in flmcr), an operating state may be entered in which the vector will not be read correctly in the exception handling sequence, resulting in program runaway. all interrupt sources should therefore be masked to prevent interrupt generation while programming or erasing the flash memory.
section 6 rom rev. 6.00 sep 12, 2006 page 150 of 526 rej09b0326-0600 6.8 flash memory prom mode (h8/3644f, h8/3643f, and h8/3642af) 6.8.1 prom mode setting the h8/3644f, h8/3643f, and h8/3642af, in which the on-chip rom is flash memory, have a prom mode as well as the on-board programming modes for programming and erasing flash memory. in prom mode, the on-chip rom can be freely programmed using a general-purpose prom programmer. 6.8.2 memory map figure 6.17 shows the memory map in prom mode. on-chip rom area h8/3644f prom mode h'0000 h'7fff * h'0000 h'7fff * h'1ffff mpu mode note: * this example applies to the h8/3644f. this address is h'5fff in the h8/3643f, and h'3fff in the h8/3642af. ? 1 ? output figure 6.17 memory map in prom mode
section 6 rom rev. 6.00 sep 12, 2006 page 151 of 526 rej09b0326-0600 6.8.3 operation in prom mode the program/erase/verify specifications in prom mode are the same as for the standard hn28f101 flash memory. the h8/3644f, h8/3643f, and h8/3642af do not have a device recognition code, so the programmer cannot read the device name automatically. table 6.13 shows how the different operating modes are selected when using prom mode. table 6.13 operating mode selection in prom mode pins mode fv pp v cc ce ce ce ce oe oe oe oe we we we we d 7 to d 0 a 16 to a 0 read read v cc * v cc l l h data output address input output disable v cc * v cc l h h high impedance standby v cc * v cc h x x high impedance command read v pp v cc l l h data output write output disable v pp v cc l h h high impedance standby v pp v cc h x x high impedance write v pp v cc l h l data input legend: l: low level h: high level v pp : v pp level v cc : v cc level x: don?t care note: * in these states, the fv pp pin must be set to v cc . v h : 11.5 v v h 12.5 v
section 6 rom rev. 6.00 sep 12, 2006 page 152 of 526 rej09b0326-0600 table 6.14 prom mode commands 1st cycle 2nd cycle command cycles mode address data mode address data memory read 1 write x h'00 read ra dout erase setup/erase 2 write x h'20 write x h'20 erase-verify 2 write ea h'a0 read x evd auto-erase setup/ auto-erase 2 write x h'30 write x h'30 program setup/ program 2 write x h'40 write pa pd program-verify 2 write x h'c0 read x pvd reset 2 write x h'ff write x h'ff legend: pa: program address ea: erase-verify address ra: read address pd: program data pvd: program-verify output data evd: erase-verify output data
section 6 rom rev. 6.00 sep 12, 2006 page 153 of 526 rej09b0326-0600 high-speed, high-reliability programming: unused areas of the flash memory in the h8/3644f, h8/3643f, or h8/3642af contain h'ff data (initial value). the flash memory uses a high-speed, high-reliability programming procedure. this procedure provides higher programming speed without subjecting the device to voltage stress and without sacrificing the reliability of the programmed data. figure 6.18 shows the basic high-speed, high-reliability programming flowchart. tables 6.15 and 6.16 list the electrical characteristics during programming. start end error set v pp = 12.0 v 0.6 v address = 0 n = 0 n + 1 n program setup command ng no no yes ok yes program command wait (25 s) program-verify command wait (6 s) address + 1 address set v pp = v cc verify? n = 20? last address? figure 6.18 high-speed, high-reliability programming
section 6 rom rev. 6.00 sep 12, 2006 page 154 of 526 rej09b0326-0600 high-speed, high-reliability erasing: the flash memory in the h8/3644f, h8/3643f, and h8/3642af uses a high-speed, high-reliability erasing procedure. this procedure provides higher erasing speed without subjecting the device to voltage stress and without sacrificing the reliability of data reliability. figure 6.19 shows the basic high-speed, high-reliability erasing flowchart. tables 6.15 and 6.16 list the electrical characteristics during erasing. start end error program all bits to 0 * address = 0 n = 0 n + 1 n erase setup/erase command erase-verify command ng no no yes ok yes wait (10 ms) wait (6 s) address + 1 address verify? n = 3000? last address? note: * follow the high-speed, high-reliability programming flowchart in programming all bits. if 0 has already been written, perform programming for unprogrammed bits. figure 6.19 high-speed, high-reliability erasing
section 6 rom rev. 6.00 sep 12, 2006 page 155 of 526 rej09b0326-0600 table 6.15 dc characteristics in prom mode (conditions: v cc = 5.0 v 10%, v pp = 12.0 v 0.6 v, v ss = 0 v, t a = 25c 5c) item symbol min typ max unit test conditions input high voltage fo 7 to fo 0 , fa 16 to fa 0 , oe , ce , we v ih 2.2 ? v cc + 0.3 v input low voltage fo 7 to fo 0 , fa 16 to fa 0 , oe , ce , we v il ?0.3 ? 0.8 v output high voltage fo 7 to fo 0 v oh 2.4 ? ? v i oh = ?200 a output low voltage fo 7 to fo 0 v ol ? ? 0.45 v i ol = 1.6 ma input leakage current fo 7 to fo 0 , fa 16 to fa 0 , oe , ce , we | i li | ? ? 2 a v in = 0 to v cc v cc read i cc ? 40 80 ma current program i cc ? 40 80 ma erase i cc ? 40 80 ma fv pp read i pp ? ? 10 a v pp = 2.7 to 5.5 v current ? 10 20 ma v pp = 12.6 v program i pp ? 20 40 ma v pp = 12.6 v erase i pp ? 20 40 ma v pp = 12.6 v
section 6 rom rev. 6.00 sep 12, 2006 page 156 of 526 rej09b0326-0600 table 6.16 ac characteristics in prom mode (conditions: v cc = 5.0 v 10%, v pp = 12.0 v 0.6 v, v ss = 0 v, t a = 25c 5c) item symbol min typ max unit test conditions command write cycle t cwc 120 ? ? ns figure 6.20 address setup time t as 0 ? ? ns figure 6.21 * address hold time t ah 60 ? ? ns figure 6.22 data setup time t ds 50 ? ? ns data hold time t dh 10 ? ? ns ce setup time t ces 0 ? ? ns ce hold time t ceh 0 ? ? ns v pp setup time t vps 100 ? ? ns v pp hold time t vph 100 ? ? ns we programming pulse width t wep 70 ? ? ns we programming pulse high time t weh 40 ? ? ns oe setup time before command write t oews 0 ? ? ns oe setup time before verify t oers 6 ? ? s verify access time t va ? ? 500 ns oe setup time before status polling t oeps 120 ? ? ns status polling access time t spa ? ? 120 ns program wait time t ppw 25 ? ? s erase wait time t et 9 ? 11 ms output disable time t df 0 ? 40 ns total auto-erase time t aet 0.5 ? 30 s notes: the ce , oe , and we pins should be driven high during transitions of v pp from 5 v to 12 v and from 12 v to 5 v. * input pulse level: 0.45 v to 2.4 v input rise time and fall time 10 ns timing reference levels: 0.8 v and 2.0 v for input; 0.8 v and 2.0 v for output
section 6 rom rev. 6.00 sep 12, 2006 page 157 of 526 rej09b0326-0600 5.0 v 12 v v cc v pp 5.0 v t vps t ceh t oeps status polling t ceh t oews t wep t ces t ces t cwc t ces t weh t ds t ds t dh t dh t spa t df t wep t aet t vph auto-erase setup auto-erase and status polling i/o7 i/o0 to i/o6 address oe we ce command input command input command input command input figure 6.20 auto-erase timing
section 6 rom rev. 6.00 sep 12, 2006 page 158 of 526 rej09b0326-0600 5.0 v 12 v v cc v pp 5.0 v program setup program program-verify i/o7 i/o0 to i/o6 address oe we ce command input command input command input valid data output command input command input command input t vps t ah t vph t as t cwc t ces t wep t ppw t wep t ds t dh t ceh t oews t ceh t weh t ces t ceh t wep t oers t va t ces t ds t dh t df t ds t dh valid address valid data output note: program-verify data output values maybe intermediate between 1 and 0 if programming is insufficient. figure 6.21 high-speed, high-reliability programming timing
section 6 rom rev. 6.00 sep 12, 2006 page 159 of 526 rej09b0326-0600 5.0 v 12 v v cc v pp 5.0 v erase setup erase erase -verify i/o0 to i/o7 address oe we ce command input t vps t as t ah t vph valid data output valid address t ces t ces t wep t wep t wep t oers t et t weh t va t df t ceh t dh t ds t oews t cwc t ceh t ces t ceh t dh t ds t dh t ds command input command input note: erase -verify data output values maybe intermediate between 1 and 0 if erasing is insufficient. figure 6.22 erase timing
section 6 rom rev. 6.00 sep 12, 2006 page 160 of 526 rej09b0326-0600 6.9 flash memory programming and erasing precautions precautions concerning the use of on-board programming modes and prom mode are summarized below. 1. program with the specified voltages and timing. the rated programming voltage (v pp ) of the flash memory is 12.0 v. if the prom programmer is set to renesas hn28f101 specifications, v pp will be 12.0 v. applied voltages in excess of the rating can permanently damage the device. in particular, insure that the peak overshoot of the prom programmer does not exceed the maximum rating of 13 v. 2. before programming, check that the chip is correctly mounted in the prom programmer. overcurrent damage to the device can result if the index marks on the prom programmer socket, socket adapter, and chip are not correctly aligned. 3. do not touch the socket adapter or chip while programming. touching either of these can cause contact faults and write errors. 4. set h'ff as the prom programmer buffer data for the following addresses: h8/3644f: h'8000 to h'1ffff h8/3643f: h'6000 to h'1ffff h8/3642af: h'4000 to h'1ffff the size of the prom area is 32 kbytes in the h8/3644f, 24 kbytes in the h8/3643f, and 16 kbytes in the h8/3642af. the addresses shown above always read h'ff, so if h'ff is not specified as programmer data, a block error will occur. 5. precautions in applying, releasing, and cutting * 1 the programming voltage (v pp ) a. apply the programming voltage (v pp ) after v cc has stabilized, and release v pp before cutting v cc . to avoid programming or erasing flash memory by mistake, v pp should only be applied, released, and cut when the mcu is in a ?stable operating condition? as described below. mcu stable operating condition ? the v cc voltage must be within the rated voltage range (v cc = 2.7 v to 5.5 v). if the v pp voltage is applied, released, or cut while v cc is not within its rated voltage range (v cc = 2.7 v to 5.5 v), since the mcu is unstable, the flash memory may be programmed or erased by mistake. this can occur even if v cc = 0 v. adequate power supply measures should be taken, such as the insertion of a bypass capacitor, to prevent fluctuation of the v cc power supply when v pp is applied.
section 6 rom rev. 6.00 sep 12, 2006 page 161 of 526 rej09b0326-0600 ? oscillation must have stabilized (following the elapse of the oscillation settling time) or be stopped. when the v cc power is turned on, hold the res pin low for the duration of the oscillation settling time * 2 (t rc = 20 ms) before applying v pp . ? the mcu must be in the reset state, or in a state in which reset has ended normally (reset has been released) and flash memory is not being accessed. apply or release v pp either in the reset state, or when the cpu is not accessing flash memory (when a program in on-chip ram or external memory is executing). flash memory data cannot be read normally at the instant when v pp is applied or released, so do not read flash memory while v pp is being applied or released. for a reset during operation, apply or release v pp only after the res pin has been held low for at least 10 system clock cycles (10 ). ? the p and e bits must be cleared in the flash memory control register (flmcr). when applying or releasing v pp , make sure that the p or e bit is not set by mistake. ? there must be no program runaway. when v pp is applied, program execution must be supervised, e.g. by the watchdog timer. these power-on and power-off timing requirements for v cc and v pp should also be satisfied in the event of a power failure and in recovery from a power failure. if these requirements are not satisfied, overprogramming or overerasing may occur due to program runaway, etc., which could cause memory cells to malfunction. b. the v pp flag is set and cleared by a threshold decision on the voltage applied to the fv pp pin. the threshold level is approximately in the range from v cc +2 v to 11.4 v. when this flag is set, it becomes possible to write to the flash memory control register (flmcr) and the erase block registers (ebr1 and ebr2), even though the v pp voltage may not yet have reached the programming voltage range of 12.0 v 0.6 v. do not actually program or erase the flash memory until v pp has reached the programming voltage range. the programming voltage range for programming and erasing flash memory is 12.0 v 0.6 v (11.4 v to 12.6 v). programming and erasing cannot be performed correctly outside this range. when not programming or erasing the flash memory, insure that the v pp voltage does not exceed the v cc voltage. this will prevent unintentional programming and erasing. notes: 1. definitions of v pp application, release, and cut-off are as follows: application: raising the voltage from v cc to 12.0 v 0.6 v release: dropping the voltage from 12.0 v 0.6 v to v cc cut-off: halting voltage application (floating state) 2. the time depends on the resonator used; refer to the electrical characteristics.
section 6 rom rev. 6.00 sep 12, 2006 page 162 of 526 rej09b0326-0600 t osc1 3.0 to 5.5 v 12 0.6 v 12 0.6 v v cc + 2 v to 11.4 v v cc v v cc v v cc v pp (boot mode) period during which flash memory access is prohibited and v pp flag set/clear period v pp (user program mode) res 0 s min. 0 s min. timing of boot program branch to ram space min. 10 cycles (when res is low) 0 s min. 0 to v cc v 0 to v cc v figure 6.23 v pp power-on and cut-off timing 6. do not apply 12 v to the fv pp pin during normal operation. to prevent erroneous programming or erasing due to program runaway, etc., apply 12 v to the fv pp pin only when programming or erasing flash memory. if overprogramming or overerasing occurs due to program runaway, etc., the memory cells may not operate normally. a system configuration in which a high level is constantly applied to the fv pp pin should be avoided. also, while a high level is applied to the fv pp pin, the watchdog timer should be activated to prevent overprogramming or overerasing due to program runaway, etc.
section 6 rom rev. 6.00 sep 12, 2006 page 163 of 526 rej09b0326-0600 7. design a current margin into the programming voltage (v pp ) power supply. insure that v pp remains within the range 12.0 v 0.6 v (11.4 v to 12.6 v) during programming and erasing. programming and erasing may become impossible outside this range. 8. insure that peak overshoot at the fv pp and test pins does not exceed the maximum rating. connect bypass capacitors as close as possible to the fv pp and test pins. in boot mode start-up, also, bypass capacitors should be connected to the test pin in the same way. 0.01 f fv pp h8/3644f 1.0 f 12 v figure 6.24 example of v pp power supply circuit design 9. use the recommended algorithms when programming and erasing flash memory. the recommended algorithms enable programming and erasing to be carried out without subjecting the device to voltage stress or sacrificing program data reliability. when setting the program (p) or erase (e) bit in the flash memory control register (flmcr), the watchdog timer should be set beforehand to prevent the specified time from being exceeded. 10. for comments on interrupt handling while flash memory is being programmed or erased, see section 6.7.9, interrupt handling during flash memory programming/erasing. 11. notes on accessing flash memory control registers a. flash memory control register access state in each operating mode the h8/3644f, h8/3643f, and h8/3642af have flash memory control registers located at addresses h'ff80 (flmcr), h'ff82 (ebr1), and h'ff83 (ebr2). these registers can only be accessed when 12 v is applied to the flash memory programming power supply pin, fv pp . b. to check for 12 v application/non-application in user mode when address h'ff80 is accessed in user mode, if 12 v is being applied to fv pp , flmcr is read/written to, and its initial value after reset is h'80. when 12 v is not being applied to fv pp , flmcr is a reserved area that cannot be modified and always reads h'ff. since bit 7 (corresponding to the v pp bit) is set to 1 at this time regardless of whether or not 12 v is applied to fv pp , application or release of 12 v to fv pp cannot be determined simply from
section 6 rom rev. 6.00 sep 12, 2006 page 164 of 526 rej09b0326-0600 the 0 or 1 status of this bit. a byte data comparison is necessary to check whether 12v is being applied. the relevant coding is shown below. . . label1: mov.b @h'ff80, r1l cmp.b #h'ff, r1l beq label1 . . . sample program for detection of 12 v application to fv pp (user mode) table 6.17 flash memory dc characteristics v cc = 3.0 v to 5.5 v, av cc = 3.0 v to 5.5 v, av ref = 3.0 v to av cc , v ss = av ss = 0 v, v pp = 12.0 v 0.6 v t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) item symbol min typ max unit test conditions high voltage (12 v) application criterion level * fv pp , test v h v cc + 2 ? 11.4 v fv pp current read i pp ? ? 10 a v pp = 2.7 to 5.5 v ? 10 20 ma v pp = 12.6 v program ? 20 40 ma erase ? 20 40 ma note: * the high voltage application criterion level is as shown in the table above, but a setting of 12.0 v 0.6 v should be made in boot mode and when programming and erasing flash memory.
section 6 rom rev. 6.00 sep 12, 2006 page 165 of 526 rej09b0326-0600 table 6.18 flash memory ac characteristics v cc = 3.0 v to 5.5 v, av cc = 3.0 v to 5.5 v, av ref = 3.0 v to av cc , v ss = av ss = 0 v, v pp = 12.0 v 0.6 v t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) item symbol min typ max unit test conditions programming time * 1 * 2 t p ? 50 1000 s erase time * 1 * 3 t e ? 1 30 s reprogramming capability n wec ? ? 100 times verify setup time 1 * 1 t vs1 4 ? ? s verify setup time 2 * 1 t vs2 2 ? ? s flash memory read setup time * 4 t frs 50 ? ? s v cc 4.5 v 100 ? ? v cc < 4.5 v notes: 1. follow the program/erase algorithms shown in section 6 when making the settings. 2. indicates the programming time per byte (the time during which the p bit is set in the flash memory control register (flmcr)). does not include the program-verify time. 3. indicates the time to erase all blocks (32 kb) (the time during which the e bit is set in flmcr). does not include the prewrite time before erasing of the erase-verify time. 4. after powering on when using an external clock, when the programming voltage (v pp ) is switched from 12 v to v cc , an interval at least equal to the read setup time must be allowed to elapse before reading the flash memory. when v pp is released, this specifies the setup time from the point at which the v pp voltage reaches the v cc + 2 v level until the flash memory is read.
section 6 rom rev. 6.00 sep 12, 2006 page 166 of 526 rej09b0326-0600
section 7 ram rev. 6.00 sep 12, 2006 page 167 of 526 rej09b0326-0600 section 7 ram 7.1 overview the h8/3644 group has 1 kbyte and 512 byte of high-speed static ram on-chip. the ram is connected to the cpu by a 16-bit data bus, allowing high-speed 2-state access for both byte data and word data. 7.1.1 block diagram figure 7.1 shows a block diagram of the on-chip ram. h'ff7e h'ff7f internal data bus (upper 8 bits) internal data bus (lower 8 bits) even-numbered address odd-numbered address h'ff7e h'fb82 h'fb80 h'fb80 h'fb82 h'fb81 h'fb83 on-chip ram figure 7.1 ram block diagram
section 7 ram rev. 6.00 sep 12, 2006 page 168 of 526 rej09b0326-0600
section 8 i/o ports rev. 6.00 sep 12, 2006 page 169 of 526 rej09b0326-0600 section 8 i/o ports 8.1 overview the h8/3644 group is provided with three 8-bit i/o ports, three 5-bit i/o ports, two 3-bit i/o ports, and one 8-bit input-only port. table 8.1 indicates the functions of each port. each port has of a port control register (pcr) that controls input and output, and a port data register (pdr) for storing output data. input or output can be assigned to individual bits. see section 2.9.2, notes on bit manipulation, for information on executing bit-manipulation instructions to write data in pcr or pdr. block diagrams of each port are given in appendix c, i/o port block diagrams. table 8.1 port functions port description pins other functions function switching register port 1 ? 5-bit i/o port ? input pull-up mos selectable p1 7 / irq 3 /trgv p1 6 to p1 5 / irq 2 to irq 1 external interrupt 3, timer v trigger input external interrupts 2 and 1 pmr1 p1 4 /pwm 14-bit pwm output pmr1 p1 0 /tmow timer a clock output pmr1 port 2 ? 3-bit i/o port p2 2 /txd sci3 data output pmr7 p2 1 /rxd sci3 data input scr3 p2 0 /sck 1 sci3 clock input/output scr3, smr port 3 ? 3-bit i/o port ? input pull-up mos selectable p3 2 /so 1 p3 1 /si 1 p3 0 /sck 1 sci1 data output (so 1 ), data input (si 1 ), clock input/output (sck 1 ) pmr3 port 5 ? 8-bit i/o port p5 7 / int 7 int interrupt 7 ? input pull-up mos p5 6 / int 6 / tmib int interrupt 6 timer b1 event input p5 5 / int 5 / adtrg int interrupt 5 a/d converter external trigger input p5 4 to p5 0 / int 4 to int 0 int interrupts 4 to 0
section 8 i/o ports rev. 6.00 sep 12, 2006 page 170 of 526 rej09b0326-0600 port description pins other functions function switching register port 6 ? 8-bit i/o port ? high-current port p6 7 to p6 0 port 7 ? 5-bit i/o port p7 7 p7 6 /tmov timer v compare-match output tcsrv p7 5 /tmciv timer v clock input p7 4 /tmriv timer v reset input p7 3 port 8 ? 8-bit i/o port p8 7 p8 6 /ftid timer x input capture d input p8 5 /ftic timer x input capture c input p8 4 /ftib timer x input capture b input p8 3 /ftia timer x input capture a input p8 2 /ftob timer x output compare b output tocr p8 1 /ftoa timer x output compare a output tocr p8 0 /ftci timer x clock input port 9 ? 5-bit i/o port p9 0 * to p9 4 port b ? 8-bit input port pb 7 to pb 0 / an 7 to an 0 a/d converter analog input (an 7 to an 0 ) note: * there is no p9 0 function in the flash memory version since p9 0 is used as the fv pp pin.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 171 of 526 rej09b0326-0600 8.2 port 1 8.2.1 overview port 1 is a 5-bit i/o port. figure 8.1 shows its pin configuration. p1 / irq /trgv p1 / irq p1 / irq p1 /pwm p1 /tmow 7 6 5 4 0 3 2 1 port 1 figure 8.1 port 1 pin configuration 8.2.2 register configuration and description table 8.2 shows the port 1 register configuration. table 8.2 port 1 registers name abbr. r/w initial value address port data register 1 pdr1 r/w h'00 h'ffd4 port control register 1 pcr1 w h'00 h'ffe4 port pull-up control register 1 pucr1 r/w h'00 h'ffed port mode register 1 pmr1 r/w h'04 h'fffc port data register 1 (pdr1) bit 7 6 5 4 3 2 1 0 p1 7 p1 6 p1 5 p1 4 ? ? ? p1 0 initial value 0 0 0 0 0 * 0 * 0 * 0 read/write r/w r/w r/w r/w ? ? ? r/w note: * bits 3 to 1 are reserved; they are always read as 0 and cannot be modified.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 172 of 526 rej09b0326-0600 pdr1 is an 8-bit register that stores data for port 1 pins p1 7 through p1 4 and p1 0 . if port 1 is read while pcr1 bits are set to 1, the values stored in pdr1 are read, regardless of the actual pin states. if port 1 is read while pcr1 bits are cleared to 0, the pin states are read. upon reset, pdr1 is initialized to h'00. port control register 1 (pcr1) bit 7 6 5 4 3 2 1 0 pcr1 7 pcr1 6 pcr1 5 pcr1 4 ? ? ? pcr1 0 initial value 0 0 0 0 0 0 0 0 read/write w w w w ? ? ? w pcr1 is an 8-bit register for controlling whether each of the port 1 pins p1 7 through p1 4 and p1 0 functions as an input pin or output pin. setting a pcr1 bit to 1 makes the corresponding pin an output pin, while clearing the bit to 0 makes the pin an input pin. the settings in pcr1 and in pdr1 are valid only when the corresponding pin is designated in pmr1 as a general i/o pin. upon reset, pcr1 is initialized to h'00. pcr1 is a write-only register, which is always read as all 1s. port pull-up control register 1 (pucr1) bit 7 6 5 4 3 2 1 0 pucr1 7 pucr1 6 pucr1 5 pucr1 4 ? ? ? pucr1 0 initial value 0 0 0 0 0 * 0 * 0 * 0 read/write r/w r/w r/w r/w ? ? ? r/w note: * bits 3 to 1 are reserved; they are always read as 0 and cannot be modified. pucr1 controls whether the mos pull-up of each of the port 1 pins p1 7 through p1 4 and p1 0 is on or off. when a pcr1 bit is cleared to 0, setting the corresponding pucr1 bit to 1 turns on the mos pull-up for the corresponding pin, while clearing the bit to 0 turns off the mos pull-up. upon reset, pucr1 is initialized to h'00.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 173 of 526 rej09b0326-0600 port mode register 1 (pmr1) bit 7 6 5 4 3 2 1 0 irq3 irq2 irq1 pwm ? ? ? tmow initial value 0 0 0 0 0 1 0 0 read/write r/w r/w r/w r/w ? ? ? r/w pmr1 is an 8-bit read/write register, controlling the selection of pin functions for port 1 pins. upon reset, pmr1 is initialized to h'04. bit 7 ? ? ? ? p1 7 / irq irq irq irq 3 /trgv pin function switch (irq3): this bit selects whether pin p1 7 / irq 3 /trgv is used as p1 7 or as irq 3 /trgv. bit 7: irq3 description 0 functions as p1 7 i/o pin (initial value) 1 functions as irq 3 /trgv input pin note: rising or falling edge sensing can be designated for irq 3 . rising, falling, or both edge sensing can be designated for trgv. for details on trgv settings, see section 9.4.2, register descriptions. bit 6 ? ? ? ? p1 6 / irq irq irq irq 2 pin function switch (irq2): this bit selects whether pin p1 6 / irq 2 is used as p1 6 or as irq 2 . bit 6: irq2 description 0 functions as p1 6 i/o pin (initial value) 1 functions as irq 2 input pin note: rising or falling edge sensing can be designated for irq 2 . bit 5 ? ? ? ? p1 5 / irq irq irq irq 1 pin function switch (irq1): this bit selects whether pin p1 5 / irq 1 is used as p1 5 or as irq 1 . bit 5: irq1 description 0 functions as p1 5 i/o pin (initial value) 1 functions as irq 1 input pin note: rising or falling edge sensing can be designated for irq 1 .
section 8 i/o ports rev. 6.00 sep 12, 2006 page 174 of 526 rej09b0326-0600 bit 4 ? ? ? ? p1 4 /pwm pin function switch (pwm): this bit selects whether pin p1 4 /pwm is used as p1 4 or as pwm. bit 4: pwm description 0 functions as p1 4 i/o pin (initial value) 1 functions as pwm output pin bit 3 ? ? ? ? reserved bit: bit 3 is reserved: it is always read as 0 and cannot be modified. bit 2 ? ? ? ? reserved bit: bit 2 is reserved: it is always read as 1 and cannot be modified. bit 1 ? ? ? ? reserved bit: bit 1 is reserved: it is always read as 0 and cannot be modified. bit 0 ? ? ? ? p1 0 /tmow pin function switch (tmow): this bit selects whether pin p1 0 /tmow is used as p1 0 or as tmow. bit 0: tmow description 0 functions as p1 0 i/o pin (initial value) 1 functions as tmow output pin
section 8 i/o ports rev. 6.00 sep 12, 2006 page 175 of 526 rej09b0326-0600 8.2.3 pin functions table 8.3 shows the port 1 pin functions. table 8.3 port 1 pin functions pin pin functions and selection method p1 7 / irq 3 /trgv the pin function depends on bit irq3 in pmr1 and bit pcr1 7 in pcr1. irq3 0 1 pcr1 7 0 1 * pin function p1 7 input pin p1 7 output pin irq 3 /trgv input pin p1 6 / irq 2 p1 5 / irq 1 the pin function depends on bits irq2 and irq1 in pmr1 and bit pcr1 n in pcr1. (m = n ? 4, n = 6, 5) irq m 0 1 pcr1 n 0 1 * pin function p1 n input pin p1 n output pin irq m input pin p1 4 /pwm the pin function depends on bit pwm in pmr1 and bit pcr1 4 in pcr1. pwm 0 1 pcr1 4 0 1 * pin function p1 4 input pin p1 4 output pin pwm output pin p1 0 /tmow the pin function depends on bit tmow in pmr1 and bit pcr1 0 in pcr1. tmow 0 1 pcr1 0 0 1 * pin function p1 0 input pin p1 0 output pin tmow output pin legend: * don?t care
section 8 i/o ports rev. 6.00 sep 12, 2006 page 176 of 526 rej09b0326-0600 8.2.4 pin states table 8.4 shows the port 1 pin states in each operating mode. table 8.4 port 1 pin states pins reset sleep subsleep standby watch subactive active p1 7 / irq 3 /trgv p1 6 / irq 2 p1 5 / irq 1 p1 4 /pwm p1 0 /tmow high- impedance retains previous state retains previous state high- impedance * retains previous state functional functional note: * a high-level signal is output when the mos pull-up is in the on state. 8.2.5 mos input pull-up port 1 has a built-in mos input pull-up function that can be controlled by software. when a pcr1 bit is cleared to 0, setting the corresponding pucr1 bit to 1 turns on the mos input pull-up for that pin. the mos input pull-up function is in the off state after a reset. pcr1 n 0 1 pucr1 n 0 1 * mos input pull-up off on off legend: * don?t care note: n = 7 to 4, 0
section 8 i/o ports rev. 6.00 sep 12, 2006 page 177 of 526 rej09b0326-0600 8.3 port 2 8.3.1 overview port 2 is a 3-bit i/o port, configured as shown in figure 8.2. p2 /txd p2 /rxd p2 /sck 2 1 0 port 2 3 figure 8.2 port 2 pin configuration 8.3.2 register configuration and description table 8.5 shows the port 2 register configuration. table 8.5 port 2 registers name abbr. r/w initial value address port data register 2 pdr2 r/w h'00 h'ffd5 port control register 2 pcr2 w h'00 h'ffe5 port data register 2 (pdr2) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? p2 2 p2 1 p2 0 initial value 0 * 0 * 0 * 0 * 0 * 0 0 0 read/write ? ? ? ? ? r/w r/w r/w note: * bits 7 to 3 are reserved; they are always read as 0 and cannot be modified. pdr2 is an 8-bit register that stores data for port 2 pins p2 2 to p2 0 . if port 2 is read while pcr2 bits are set to 1, the values stored in pdr2 are read, regardless of the actual pin states. if port 2 is read while pcr2 bits are cleared to 0, the pin states are read. upon reset, pdr2 is initialized to h'00.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 178 of 526 rej09b0326-0600 port control register 2 (pcr2) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? pcr2 2 pcr2 1 pcr2 0 initial value 0 0 0 0 0 0 0 0 read/write ? ? ? ? ? w w w pcr2 is an 8-bit register for controlling whether each of the port 1 pins p2 2 to p2 0 functions as an input pin or output pin. setting a pcr2 bit to 1 makes the corresponding pin an output pin, while clearing the bit to 0 makes the pin an input pin. the settings in pcr2 and pdr2 are valid only when the corresponding pin is designated in scr3 as a general i/o pin. upon reset, pcr2 is initialized to h'00. pcr2 is a write-only register, which is always read as all 1s.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 179 of 526 rej09b0326-0600 8.3.3 pin functions table 8.6 shows the port 2 pin functions. table 8.6 port 2 pin functions pin pin functions and selection method p2 2 /txd the pin function depends on bit txd in pmr7 and bit pcr2 2 in pcr2. txd 0 1 pcr2 2 0 1 * pin function p2 2 input pin p2 2 output pin txd output pin p2 1 /rxd the pin function depends on bit re in scr3 and bit pcr2 1 in pcr2. re 0 1 pcr2 1 0 1 * pin function p2 1 input pin p2 1 output pin rxd input pin p2 0 /sck 3 the pin function depends on bits cke1 and cke0 in scr3, bit com in smr, and bit pcr2 0 in pcr2. cke1 0 1 cke0 0 1 * com 0 1 * * pcr2 0 0 1 * * pin function p2 0 input pin p2 0 output pin sck 3 output pin sck 3 input pin legend: * don?t care 8.3.4 pin states table 8.7 shows the port 2 pin states in each operating mode. table 8.7 port 2 pin states pins reset sleep subsleep standby watch subactive active p2 2 /txd p2 1 /rxd p2 0 /sck 3 high- impedance retains previous state retains previous state high- impedance retains previous state functional functional
section 8 i/o ports rev. 6.00 sep 12, 2006 page 180 of 526 rej09b0326-0600 8.4 port 3 8.4.1 overview port 3 is a 8-bit i/o port, configured as shown in figure 8.3. p3 /so p3 /si p3 /sck 2 1 0 port 3 1 1 1 figure 8.3 port 3 pin configuration 8.4.2 register configuration and description table 8.8 shows the port 3 register configuration. table 8.8 port 3 registers name abbr. r/w initial value address port data register 3 pdr3 r/w h'00 h'ffd6 port control register 3 pcr3 w h'00 h'ffe6 port pull-up control register 3 pucr3 r/w h'00 h'ffee port mode register 3 pmr3 r/w h'00 h'fffd port mode register 7 pmr7 r/w h'f8 h'ffff port data register 3 (pdr3) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? p3 2 p3 1 p3 0 initial value 0 * 0 * 0 * 0 * 0 * 0 0 0 read/write ? ? ? ? ? r/w r/w r/w note: * bits 7 to 3 are reserved; they are always read as 0 and cannot be modified. pdr3 is an 8-bit register that stores data for port 3 pins p3 2 to p3 0 . if port 3 is read while pcr3 bits are set to 1, the values stored in pdr3 are read, regardless of the actual pin states. if port 3 is read while pcr3 bits are cleared to 0, the pin states are read.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 181 of 526 rej09b0326-0600 upon reset, pdr3 is initialized to h'00. port control register 3 (pcr3) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? pcr3 2 pcr3 1 pcr3 0 initial value 0 0 0 0 0 0 0 0 read/write ? ? ? ? ? w w w pcr3 is an 8-bit register for controlling whether each of the port 3 pins p3 2 to p3 0 functions as an input pin or output pin. setting a pcr3 bit to 1 makes the corresponding pin an output pin, while clearing the bit to 0 makes the pin an input pin. the settings in pcr3 and in pdr3 are valid only when the corresponding pin is designated in pmr3 as a general i/o pin. upon reset, pcr3 is initialized to h'00. pcr3 is a write-only register, which is always read as all 1s. port pull-up control register 3 (pucr3) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? pucr3 2 pucr3 1 pucr3 0 initial value 0 * 0 * 0 * 0 * 0 * 0 0 0 read/write ? ? ? ? ? r/w r/w r/w note: * bits 7 to 3 are reserved; they are always read as 0 and cannot be modified. pucr3 controls whether the mos pull-up of each of the port 3 pins p3 2 to p3 0 is on or off. when a pcr3 bit is cleared to 0, setting the corresponding pucr3 bit to 1 turns on the mos pull-up for the corresponding pin, while clearing the bit to 0 turns off the mos pull-up. upon reset, pucr3 is initialized to h'00. port mode register 3 (pmr3) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? so1 si1 sck1 initial value 0 0 0 0 0 0 0 0 read/write ? ? ? ? ? r/w r/w r/w
section 8 i/o ports rev. 6.00 sep 12, 2006 page 182 of 526 rej09b0326-0600 pmr3 is an 8-bit read/write register, controlling the selection of pin functions for port 3 pins. upon reset, pmr3 is initialized to h'00. bits 7 to 3 ? ? ? ? reserved bits: bits 7 to 3 are reserved: they are always read as 0 and cannot be modified. bit 2 ? ? ? ? p3 2 /so 1 pin function switch (so1): this bit selects whether pin p3 2 /so 1 is used as p3 2 or as so 1 . bit 2: so1 description 0 functions as p3 2 i/o pin (initial value) 1 functions as so 1 output pin bit 1 ? ? ? ? p3 1 /si 1 pin function switch (si1): this bit selects whether pin p3 1 /si 1 is used as p3 1 or as si 1 . bit 1: si1 description 0 functions as p3 1 i/o pin (initial value) 1 functions as si 1 input pin bit 0 ? ? ? ? p3 0 /sck 1 pin function switch (sck1): this bit selects whether pin p3 0 /sck 1 is used as p3 0 or as sck 1 . bit 0: sck1 description 0 functions as p3 0 i/o pin (initial value) 1 functions as sck 1 i/o pin port mode register 7 (pmr7) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? txd ? pof1 initial value 1 1 1 1 1 0 0 0 read/write ? ? ? ? ? r/w ? r/w pmr7 is an 8-bit read/write register that turns the pmos transistors of pins and p3 2 /so 1 on and off. upon reset, pmr7 is initialized to h'f8.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 183 of 526 rej09b0326-0600 bits 7 to 3 ? ? ? ? reserved bits: bits 7 to 3 are reserved; they are always read as 1, and cannot be modified. bit 2 ? ? ? ? p2 2 /txd pin function switch (txd): bit 2 selects whether pin p2 2 /txd is used as p2 2 or as txd. bit 2: txd description 0 functions as p2 2 i/o pin (initial value) 1 functions as txd output pin bit 1 ? ? ? ? reserved bit: bit 1 is reserved: it is always read as 0 and cannot be modified. bit 0 ? ? ? ? p3 2 /so 1 pin pmos control (pof1): this bit controls the pmos transistor in the p3 2 /so 1 pin output buffer. bit 0: pof1 description 0 cmos output (initial value) 1 nmos open-drain output
section 8 i/o ports rev. 6.00 sep 12, 2006 page 184 of 526 rej09b0326-0600 8.4.3 pin functions table 8.9 shows the port 3 pin functions. table 8.9 port 3 pin functions pin pin functions and selection method p3 2 /so 1 the pin function depends on bit so1 in pmr3 and bit pcr3 2 in pcr3. so1 0 1 pcr3 2 0 1 * pin function p3 2 input pin p3 2 output pin so 1 output pin p3 1 /si 1 the pin function depends on bit si1 in pmr3 and bit pcr3 1 in pcr3. si1 0 1 pcr3 1 0 1 * pin function p3 1 input pin p3 1 output pin si 1 input pin p3 0 /sck 1 the pin function depends on bit sck1 in pmr3, bit cks3 in scr1, and bit pcr3 0 in pcr3. sck1 0 1 cks3 * 0 1 pcr3 0 0 1 * * pin function p3 0 input pin p3 0 output pin sck 1 output pin sck 1 input pin legend: * don?t care
section 8 i/o ports rev. 6.00 sep 12, 2006 page 185 of 526 rej09b0326-0600 8.4.4 pin states table 8.10 shows the port 3 pin states in each operating mode. table 8.10 port 3 pin states pins reset sleep subsleep standby watch subactive active p3 2 /so 1 p3 1 /si 1 p3 0 /sck 1 high- impedance retains previous state retains previous state high- impedance * retains previous state functional functional note: * a high-level signal is output when the mos pull-up is in the on state. 8.4.5 mos input pull-up port 3 has a built-in mos input pull-up function that can be controlled by software. when a pcr3 bit is cleared to 0, setting the corresponding pucr3 bit to 1 turns on the mos pull-up for that pin. the mos pull-up function is in the off state after a reset. pcr3 n 0 1 pucr3 n 0 1 * mos input pull-up off on off legend: * don?t care note: n = 2 to 0
section 8 i/o ports rev. 6.00 sep 12, 2006 page 186 of 526 rej09b0326-0600 8.5 port 5 8.5.1 overview port 5 is an 8-bit i/o port, configured as shown in figure 8.4. p5 7 / int 7 p5 6 / int 6 /tmib p5 5 / int 5 / adtr g p5 4 / int 4 p5 3 / int 3 p5 2 / int 2 p5 1 / int 1 p5 0 / int 0 port 5 figure 8.4 port 5 pin configuration 8.5.2 register configuration and description table 8.11 shows the port 5 register configuration. table 8.11 port 5 registers name abbr. r/w initial value address port data register 5 pdr5 r/w h'00 h'ffd8 port control register 5 pcr5 w h'00 h'ffe8 port pull-up control register 5 pucr5 r/w h'00 h'ffef
section 8 i/o ports rev. 6.00 sep 12, 2006 page 187 of 526 rej09b0326-0600 port data register 5 (pdr5) bit 7 6 5 4 3 2 1 0 p5 7 p5 6 p5 5 p5 4 p5 3 p5 2 p5 1 p5 0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w pdr5 is an 8-bit register that stores data for port 5 pins p5 7 to p5 0 . if port 5 is read while pcr5 bits are set to 1, the values stored in pdr5 are read, regardless of the actual pin states. if port 5 is read while pcr5 bits are cleared to 0, the pin states are read. upon reset, pdr5 is initialized to h'00. port control register 5 (pcr5) bit 7 6 5 4 3 2 1 0 pcr5 7 pcr5 6 pcr5 5 pcr5 4 pcr5 3 pcr5 2 pcr5 1 pcr5 0 initial value 0 0 0 0 0 0 0 0 read/write w w w w w w w w pcr5 is an 8-bit register for controlling whether each of the port 5 pins p5 7 to p5 0 functions as an input pin or output pin. setting a pcr5 bit to 1 makes the corresponding pin an output pin, while clearing the bit to 0 makes the pin an input pin. upon reset, pcr5 is initialized to h'00. pcr5 is a write-only register, which is always read as all 1s. port pull-up control register 5 (pucr5) bit 7 6 5 4 3 2 1 0 pucr5 7 pucr5 6 pucr5 5 pucr5 4 pucr5 3 pucr5 2 pucr5 1 pucr5 0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w pucr5 controls whether the mos pull-up of each port 5 pin is on or off. when a pcr5 bit is cleared to 0, setting the corresponding pucr5 bit to 1 turns on the mos pull-up for the corresponding pin, while clearing the bit to 0 turns off the mos pull-up. upon reset, pucr5 is initialized to h'00.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 188 of 526 rej09b0326-0600 8.5.3 pin functions table 8.12 shows the port 5 pin functions. table 8.12 port 5 pin functions pin pin functions and selection method p5 7 / int 7 the pin function depends on bit pcr5 7 in pcr5. pcr5 7 0 1 pin function p5 7 input pin p5 7 output pin int 7 input pin p5 6 / int 6 /tmib the pin function depends on bit pcr5 6 in pcr5. pcr5 6 0 1 pin function p5 6 input pin p5 6 output pin int 6 input pin and tmib input pin p5 5 / int 5 / the pin function depends on bit pcr5 5 in pcr5. adtrg pcr5 5 0 1 pin function p5 5 input pin p5 5 output pin int 5 input pin and adtrg input pin p5 4 / int 4 to p5 0 / int 0 the pin function depends on bit pcr5 n in pcr5. (n = 4 to 0) pcr5 n 0 1 pin function p5 n input pin p5 n output pin int n input pin
section 8 i/o ports rev. 6.00 sep 12, 2006 page 189 of 526 rej09b0326-0600 8.5.4 pin states table 8.13 shows the port 5 pin states in each operating mode. table 8.13 port 5 pin states pins reset sleep subsleep standby watch subactive active p5 7 / int 7 to p5 0 / int 0 high- impedance retains previous state retains previous state high- impedance * retains previous state functional functional note: * a high-level signal is output when the mos pull-up is in the on state. 8.5.5 mos input pull-up port 5 has a built-in mos input pull-up function that can be controlled by software. when a pcr5 bit is cleared to 0, setting the corresponding pucr5 bit to 1 turns on the mos pull-up for that pin. the mos pull-up function is in the off state after a reset. pcr5 n 0 1 pucr5 n 0 1 * mos input pull-up off on off legend: * don?t care note: n = 7 to 0
section 8 i/o ports rev. 6.00 sep 12, 2006 page 190 of 526 rej09b0326-0600 8.6 port 6 8.6.1 overview port 6 is an 8-bit large-current i/o port, with a maximum sink current of 10 ma. the port 6 pin configuration is shown in figure 8.5. p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 port 6 figure 8.5 port 6 pin configuration 8.6.2 register configuration and description table 8.14 shows the port 6 register configuration. table 8.14 port 6 registers name abbr. r/w initial value address port data register 6 pdr6 r/w h'00 h'ffd9 port control register 6 pcr6 w h'00 h'ffe9 port data register 6 (pdr6) bit 7 6 5 4 3 2 1 0 p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w
section 8 i/o ports rev. 6.00 sep 12, 2006 page 191 of 526 rej09b0326-0600 pdr6 is an 8-bit register that stores data for port 6 pins p6 7 to p6 0 . when a bit in pcr6 is set to 1, if port 6 is read the value of the corresponding pdr6 bit is returned directly regardless of the pin state. when a bit in pcr6 is cleared to 0, if port 6 is read the corresponding pin state is read. upon reset, pdr6 is initialized to h'00. port control register 6 (pcr6) bit 7 6 5 4 3 2 1 0 pcr6 7 pcr6 6 pcr6 5 pcr6 4 pcr6 3 pcr6 2 pcr6 1 pcr6 0 initial value 0 0 0 0 0 0 0 0 read/write w w w w w w w w pcr6 is an 8-bit register for controlling whether each of the port 6 pins p6 7 to p6 0 functions as an input pin or output pin. when a bit in pcr6 is set to 1, the corresponding pin of p6 7 to p6 0 becomes an output pin. upon reset, pcr6 is initialized to h'00. pcr6 is a write-only register, which always reads all 1s. 8.6.3 pin functions table 8.15 shows the port 6 pin functions. table 8.15 port 6 pin functions pin pin functions and selection method p6 7 to p6 0 the pin function depends on bit pcr6 n in pcr6 (n = 7 to 0) pcr6 n 0 1 pin function p6 n input pin p6 n output pin
section 8 i/o ports rev. 6.00 sep 12, 2006 page 192 of 526 rej09b0326-0600 8.6.4 pin states table 8.16 shows the port 6 pin states in each operating mode. table 8.16 port 6 pin states pins reset sleep subsleep standby watch subactive active p6 7 top6 0 high- impedance retains previous state retains previous state high- impedance * retains previous state functional functional note: * a high-level signal is output when the mos pull-up is in the on state. 8.7 port 7 8.7.1 overview port 7 is a 8-bit i/o port, configured as shown in figure 8.6. p7 7 p7 6 /tmov p7 5 /tmciv p7 4 /tmriv p7 3 port 7 figure 8.6 port 7 pin configuration 8.7.2 register configuration and description table 8.17 shows the port 7 register configuration. table 8.17 port 7 registers name abbr. r/w initial value address port data register 7 pdr7 r/w h'00 h'ffda port control register 7 pcr7 w h'00 h'ffea
section 8 i/o ports rev. 6.00 sep 12, 2006 page 193 of 526 rej09b0326-0600 port data register 7 (pdr7) bit 7 6 5 4 3 2 1 0 p7 7 p7 6 p7 5 p7 4 p7 3 ? ? ? initial value 0 0 0 0 0 0 * 0 * 0 * read/write r/w r/w r/w r/w r/w ? ? ? note: * bits 2 to 0 are reserved; they are always read as 0 and cannot be modified. pdr7 is an 8-bit register that stores data for port 7 pins p7 7 to p7 3 . if port 7 is read while pcr7 bits are set to 1, the values stored in pdr7 are read, regardless of the actual pin states. if port 7 is read while pcr7 bits are cleared to 0, the pin states are read. upon reset, pdr7 is initialized to h'00. port control register 7 (pcr7) bit 7 6 5 4 3 2 1 0 pcr7 7 pcr7 6 pcr7 5 pcr7 4 pcr7 3 ? ? ? initial value 0 0 0 0 0 0 0 0 read/write w w w w w ? ? ? pcr7 is an 8-bit register for controlling whether each of the port 7 pins p7 7 to p7 3 functions as an input pin or output pin. setting a pcr7 bit to 1 makes the corresponding pin an output pin, while clearing the bit to 0 makes the pin an input pin. upon reset, pcr7 is initialized to h'00. pcr7 is a write-only register, which always reads as all 1s.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 194 of 526 rej09b0326-0600 8.7.3 pin functions table 8.18 shows the port 7 pin functions. table 8.18 port 7 pin functions pin pin functions and selection method p7 7 , p7 3 the pin function depends on bit pcr7 n in pcr7. (n = 7 or 3) pcr7 n 0 1 pin function p7 n input pin p7 n output pin p7 6 /tmov the pin function depends on bit pcr7 6 in pcr7 and bits os3 to os0 in tcsrv. os3 to os0 0000 not 0000 pcr7 6 0 1 * pin function p7 6 input pin p7 6 output pin tmov output pin p7 5 /tmciv the pin function depends on bit pcr7 5 in pcr7. pcr7 5 0 1 pin function p7 5 input pin p7 5 output pin tmciv input pin p7 4 /tmriv the pin function depends on bit pcr7 4 in pcr7. pcr7 4 0 1 pin function p7 4 input pin p7 4 output pin tmriv input pin legend: * don?t care
section 8 i/o ports rev. 6.00 sep 12, 2006 page 195 of 526 rej09b0326-0600 8.7.4 pin states table 8.19 shows the port 7 pin states in each operating mode. table 8.19 port 7 pin states pins reset sleep subsleep standby watch subactive active p7 7 to p7 3 high- impedance retains previous state retains previous state high- impedance retains previous state functional functional 8.8 port 8 8.8.1 overview port 8 is an 8-bit i/o port configured as shown in figure 8.7. p8 7 p8 6 /ftid p8 5 /ftic p8 4 /ftib p8 3 //ftia p8 2 /ftob p8 1 /ftoa p8 0 /ftci port 8 figure 8.7 port 8 pin configuration
section 8 i/o ports rev. 6.00 sep 12, 2006 page 196 of 526 rej09b0326-0600 8.8.2 register configuration and description table 8.20 shows the port 8 register configuration. table 8.20 port 8 registers name abbr. r/w initial value address port data register 8 pdr8 r/w h'00 h'ffdb port control register 8 pcr8 w h'00 h'ffeb port data register 8 (pdr8) bit 7 6 5 4 3 2 1 0 p8 7 p8 6 p8 5 p8 4 p8 3 p8 2 p8 1 p8 0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w pdr8 is an 8-bit register that stores data for port 8 pins p8 7 to p8 0 . if port 8 is read while pcr8 bits are set to 1, the values stored in pdr8 are read, regardless of the actual pin states. if port 8 is read while pcr8 bits are cleared to 0, the pin states are read. upon reset, pdr8 is initialized to h'00. port control register 8 (pcr8) bit 7 6 5 4 3 2 1 0 pcr8 7 pcr8 6 pcr8 5 pcr8 4 pcr8 3 pcr8 2 pcr8 1 pcr8 0 initial value 0 0 0 0 0 0 0 0 read/write w w w w w w w w pcr8 is an 8-bit register for controlling whether each of the port 8 pins p8 7 to p8 0 functions as an input or output pin. setting a pcr8 bit to 1 makes the corresponding pin an output pin, while clearing the bit to 0 makes the pin an input pin. upon reset, pcr8 is initialized to h'00. pcr8 is a write-only register, which is always read as all 1s.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 197 of 526 rej09b0326-0600 8.8.3 pin functions table 8.21 shows the port 8 pin functions. table 8.21 port 8 pin functions pin pin functions and selection method p8 7 the pin function depends on bit pcr8 7 in pcr8. pcr8 7 0 1 pin function p8 7 input pin p8 7 output pin p8 6 /ftid the pin function depends on bit pcr8 6 in pcr8. pcr8 6 0 1 pin function p8 6 input pin p8 6 output pin ftid input pin p8 5 /ftic the pin function depends on bit pcr8 5 in pcr8. pcr8 5 0 1 pin function p8 5 input pin p8 5 output pin ftic input pin p8 4 /ftib the pin function depends on bit pcr8 4 in pcr8. pcr8 4 0 1 pin function p8 4 input pin p8 4 output pin ftib input pin p8 3 /ftia the pin function depends on bit pcr8 3 in pcr8. pcr8 3 0 1 pin function p8 3 input pin p8 3 output pin ftia input pin p8 2 /ftob the pin function depends on bit pcr8 2 in pcr8 and bit oeb in tocr. oeb 0 1 pcr8 2 0 1 * pin function p8 2 input pin p8 2 output pin ftob output pin
section 8 i/o ports rev. 6.00 sep 12, 2006 page 198 of 526 rej09b0326-0600 pin pin functions and selection method p8 1 /ftoa the pin function depends on bit pcr8 1 in pcr8 and bit oea in tocr. oea 0 1 pcr8 1 0 1 * pin function p8 1 input pin p8 1 output pin ftoa output pin p8 0 /ftci the pin function depends on bit pcr8 0 in pcr8. pcr8 0 0 1 pin function p8 0 input pin p8 0 output pin ftci input pin legend: * don?t care 8.8.4 pin states table 8.22 shows the port 8 pin states in each operating mode. table 8.22 port 8 pin states pins reset sleep subsleep standby watch subactive active p8 7 to p8 0 /ftci high- impedance retains previous state retains previous state high- impedance retains previous state functional functional
section 8 i/o ports rev. 6.00 sep 12, 2006 page 199 of 526 rej09b0326-0600 8.9 port 9 8.9.1 overview port 9 is a 5-bit i/o port, configured as shown in figure 8.8. p9 p9 p9 p9 p9 * 4 3 2 1 0 port 9 note: * there is no p9 0 function in the flash memory version since p9 0 is used as the fv pp pin. figure 8.8 port 9 pin configuration 8.9.2 register configuration and description table 8.23 shows the port 9 register configuration. table 8.23 port 9 registers name abbr. r/w initial value address port data register 9 pdr9 r/w h'c0 h'ffdc port control register 9 pcr9 w h'c0 h'ffec port data register 9 (pdr9) bit 7 6 5 4 3 2 1 0 ? ? ? p9 4 p9 3 p9 2 p9 1 p9 0 * 3 initial value 1 * 1 1 * 1 0 * 2 0 0 0 0 0 read/write ? ? ? r/w r/w r/w r/w r/w notes: 1. bits 7 to 6 are reserved; they are always read as 1 and cannot be modified. 2. bit 5 is reserved; it is always read as 0 and cannot be modified. 3. in the on-chip flash memory version, this bit is always read as 0 and cannot be modified.
section 8 i/o ports rev. 6.00 sep 12, 2006 page 200 of 526 rej09b0326-0600 pdr9 is an 8-bit register that stores data for port 9 pins p9 4 to p9 0 . if port 9 is read while pcr9 bits are set to 1, the values stored in pdr9 are read, regardless of the actual pin states. if port 9 is read while pcr9 bits are cleared to 0, the pin states are read. upon reset, pdr9 is initialized to h'c0. port control register 9 (pcr9) bit 7 6 5 4 3 2 1 0 ? ? ? pcr9 4 pcr9 3 pcr9 2 pcr9 1 pcr9 0 initial value 0 0 0 0 0 0 0 0 read/write ? ? ? w w w w w pcr9 controls whether each of the port 9 pins p9 4 to p9 0 functions as an input pin or output pin. setting a pcr9 bit to 1 makes the corresponding pin an output pin, while clearing the bit to 0 makes the pin an input pin. upon reset, pcr9 is initialized to h'c0. pcr9 is a write-only register, which is always reads as all 1. 8.9.3 pin functions table 8.24 shows the port 9 pin functions. table 8.24 port 9 pin functions pin pin functions and selection method p9 n the pin function depends on bit pcr9 n in pcr9. (n = 4 to 0) pcr9 n 0 1 pin function p9 n input pin p9 n output pin
section 8 i/o ports rev. 6.00 sep 12, 2006 page 201 of 526 rej09b0326-0600 8.9.4 pin states table 8.25 shows the port 9 pin states in each operating mode. table 8.25 port 9 pin states pins reset sleep subsleep standby watch subactive active p9 4 to p9 0 high- impedance retains previous state retains previous state high- impedance retains previous state functional functional 8.10 port b 8.10.1 overview port b is an 8-bit input-only port, configured as shown in figure 8.9. pb /an pb /an pb /an pb /an pb /an pb /an pb /an pb /an 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 port b figure 8.9 port b pin configuration 8.10.2 register configuration and description table 8.26 shows the port b register configuration. table 8.26 port b register name abbr. r/w address port data register b pdrb r h'ffdd
section 8 i/o ports rev. 6.00 sep 12, 2006 page 202 of 526 rej09b0326-0600 port data register b (pdrb) bit 7 6 5 4 3 2 1 0 pb 7 pb 6 pb 5 pb 4 pb 3 pb 2 pb 1 pb 0 read/write r r r r r r r r reading pdrb always gives the pin states. however, if a port b pin is selected as an analog input channel for the a/d converter by amr bits ch3 to ch0, that pin reads 0 regardless of the input voltage. 8.10.3 pin functions table 8.27 shows the port b pin functions. table 8.27 port b pin functions pin pin functions and selection method pb n /an n always as below. (n = 7 to 0) pin function pb n input pin or an n input pin 8.10.4 pin states table 8.28 shows the port b pin states in each operating mode. table 8.28 port b pin states pins reset sleep subsleep standby watch subactive active pb n /an n high- impedance high- impedance high- impedance high- impedance high- impedance high- impedance high- impedance (n = 7 to 0)
section 9 timers rev. 6.00 sep 12, 2006 page 203 of 526 rej09b0326-0600 section 9 timers 9.1 overview the h8/3644 group provides five timers: timers a, b1, v, x, and a watchdog timer. the functions of these timers are outlined in table 9.1. table 9.1 timer functions name functions internal clock event input pin waveform output pin remarks timer a 8-bit timer ? interval function /8 to /8192 (8 choices) ? ? ? time base w /128 (choice of 4 overflow periods) ? clock output /4 to /32 w /4 to w /32 (8 choices) ? tmow timer b1 ? 8-bit timer ? interval timer ? event counter /4 to /8192 (7 choices) tmib ? timer v ? 8-bit timer ? event counter ? output control by dual compare match ? counter clearing option ? count-up start by external trigger input can be specified /4 to /128 (6 choices) tmciv tmov timer x ? 16-bit free-running timer ? 2 output compare channels ? 4 input capture channels ? counter clearing option ? event counter /2 to /32 (3 choices) ftci ftia ftib ftic ftid ftoa ftob watchdog timer ? reset signal generated when 8-bit counter overflows /8192 ? ?
section 9 timers rev. 6.00 sep 12, 2006 page 204 of 526 rej09b0326-0600 9.2 timer a 9.2.1 overview timer a is an 8-bit timer with interval timing and real-time clock time-base functions. the clock time-base function is available when a 32.768-khz crystal resonator is connected. a clock signal divided from 32.768 khz or from the system clock can be output at the tmow pin. features features of timer a are given below. ? choice of eight internal clock sources ( /8192, /4096, /2048, /512, /256, /128, /32, /8). ? choice of four overflow periods (1 s, 0.5 s, 0.25 s, 31.25 ms) when timer a is used as a clock time base (using a 32.768 khz crystal resonator). ? an interrupt is requested when the counter overflows. ? any of eight clock signals can be output from pin tmow: 32.768 khz divided by 32, 16, 8, or 4 (1 khz, 2 khz, 4 khz, 8 khz), or the system clock divided by 32, 16, 8, or 4.
section 9 timers rev. 6.00 sep 12, 2006 page 205 of 526 rej09b0326-0600 block diagram figure 9.1 shows a block diagram of timer a. psw internal data bus pss legend: tmow 1/4 tma tca /32 /16 /8 /4 w w w w /32 /16 /8 /4 /128 w /8192, /4096, /2048, /512, /256, /128, /32, /8 irrta 8 * 64 * 128 * 256 * /4 w tma: tca: irrta: psw: pss: note: * can be selected only when the prescaler w output ( w /128) is used as the tca input clock. timer mode register a timer counter a timer a overflow interrupt request flag prescaler w prescaler s w figure 9.1 block diagram of timer a pin configuration table 9.2 shows the timer a pin configuration. table 9.2 pin configuration name abbr. i/o function clock output tmow output output of waveform generated by timer a output circuit
section 9 timers rev. 6.00 sep 12, 2006 page 206 of 526 rej09b0326-0600 register configuration table 9.3 shows the register configuration of timer a. table 9.3 timer a registers name abbr. r/w initial value address timer mode register a tma r/w h'10 h'ffb0 timer counter a tca r h'00 h'ffb1 9.2.2 register descriptions timer mode register a (tma) bit 7 6 5 4 3 2 1 0 tma7 tma6 tma5 ? tma3 tma2 tma1 tma0 initial value 0 0 0 1 0 0 0 0 read/write r/w r/w r/w ? r/w r/w r/w r/w tma is an 8-bit read/write register for selecting the prescaler, input clock, and output clock. upon reset, tma is initialized to h'10. bits 7 to 5 ? ? ? ? clock output select (tma7 to tma5): bits 7 to 5 choose which of eight clock signals is output at the tmow pin. the system clock divided by 32, 16, 8, or 4 can be output in active mode and sleep mode. a 32.768 khz signal divided by 32, 16, 8, or 4 can be output in active mode, sleep mode, and subactive mode. bit 7: tma7 bit 6: tma6 bit 5: tma5 clock output 0 0 0 /32 (initial value) 1 /16 1 0 /8 1 /4 1 0 0 w /32 1 w /16 1 0 w /8 1 w /4
section 9 timers rev. 6.00 sep 12, 2006 page 207 of 526 rej09b0326-0600 bit 4 ? ? ? ? reserved bit: bit 4 is reserved; it is always read as 1, and cannot be modified. bits 3 to 0 ? ? ? ? internal clock select (tma3 to tma0): bits 3 to 0 select the clock input to tca. the selection is made as follows. description bit 3: tma3 bit 2: tma2 bit 1: tma1 bit 0: tma0 prescaler and divider ratio or overflow period function 0 0 0 0 pss, /8192 (initial value) interval timer 1 pss, /4096 1 0 pss, /2048 1 pss, /512 1 0 0 pss, /256 1 pss, /128 1 0 pss, /32 1 pss, /8 1 0 0 0 psw, 1 s clock time base 1 psw, 0.5 s 1 0 psw, 0.25 s 1 psw, 0.03125 s 1 0 0 psw and tca are reset 1 1 0 1 timer counter a (tca) bit 7 6 5 4 3 2 1 0 tca7 tca6 tca5 tca4 tca3 tca2 tca1 tca0 initial value 0 0 0 0 0 0 0 0 read/write r r r r r r r r tca is an 8-bit read-only up-counter, which is incremented by internal clock input. the clock source for input to this counter is selected by bits tma3 to tma0 in timer mode register a (tma). tca values can be read by the cpu in active mode, but cannot be read in subactive mode. when tca overflows, the irrta bit in interrupt request register 1 (irr1) is set to 1.
section 9 timers rev. 6.00 sep 12, 2006 page 208 of 526 rej09b0326-0600 tca is cleared by setting bits tma3 and tma2 of tma to 11. upon reset, tca is initialized to h'00. 9.2.3 timer operation interval timer operation: when bit tma3 in timer mode register a (tma) is cleared to 0, timer a functions as an 8-bit interval timer. upon reset, tca is cleared to h'00 and bit tma3 is cleared to 0, so up-counting and interval timing resume immediately. the clock input to timer a is selected by bits tma2 to tma0 in tma; any of eight internal clock signals output by prescaler s can be selected. after the count value in tca reaches h'ff, the next clock signal input causes timer a to overflow, setting bit irrta to 1 in interrupt request register 1 (irr1). if ienta = 1 in interrupt enable register 1 (ienr1), a cpu interrupt is requested.* at overflow, tca returns to h'00 and starts counting up again. in this mode timer a functions as an interval timer that generates an overflow output at intervals of 256 input clock pulses. note: * for details on interrupts, see section 3.3, interrupts. real-time clock time base operation: when bit tma3 in tma is set to 1, timer a functions as a real-time clock time base by counting clock signals output by prescaler w. the overflow period of timer a is set by bits tma1 and tma0 in tma. a choice of four periods is available. in time base operation (tma3 = 1), setting bit tma2 to 1 clears both tca and prescaler w to their initial values of h'00. clock output: setting bit tmow in port mode register 1 (pmr1) to 1 causes a clock signal to be output at pin tmow. eight different clock output signals can be selected by means of bits tma7 to tma5 in tma. the system clock divided by 32, 16, 8, or 4 can be output in active mode and sleep mode. a 32.768 khz signal divided by 32, 16, 8, or 4 can be output in active mode, sleep mode, and subactive mode.
section 9 timers rev. 6.00 sep 12, 2006 page 209 of 526 rej09b0326-0600 9.2.4 timer a operation states table 9.4 summarizes the timer a operation states. table 9.4 timer a operation states operation mode reset active sleep watch sub- active sub- sleep standby tca interval reset functions functions halted halted halted halted clock time base reset functions functions functions functions functions halted tma reset functions retained retained functions retained retained note: when the real-time clock time base function is selected as the internal clock of tca in active mode or sleep mode, the internal clock is not synchronous with the system clock, so it is synchronized by a synchronizing circuit. this may result in a maximum error of 1/ (s) in the count cycle. 9.3 timer b1 9.3.1 overview timer b1 is an 8-bit timer that increments each time a clock pulse is input. this timer has two operation modes, interval and auto reload. features features of timer b1 are given below. ? choice of seven internal clock sources ( /8192, /2048, /512, /256, /64, /16, /4) or an external clock (can be used to count external events). ? an interrupt is requested when the counter overflows.
section 9 timers rev. 6.00 sep 12, 2006 page 210 of 526 rej09b0326-0600 block diagram figure 9.2 shows a block diagram of timer b1. pss tmb1 tcb1 tlb1 tmib legend: irrtb1 tmb1: tcb1: tlb1: irrtb1: pss: timer mode register b1 timer counter b1 timer load register b1 timer b1 interrupt request flag prescaler s internal data bus figure 9.2 block diagram of timer b1 pin configuration table 9.5 shows the timer b1 pin configuration. table 9.5 pin configuration name abbr. i/o function timer b1 event input tmib input event input to tcb1
section 9 timers rev. 6.00 sep 12, 2006 page 211 of 526 rej09b0326-0600 register configuration table 9.6 shows the register configuration of timer b1. table 9.6 timer b1 registers name abbr. r/w initial value address timer mode register b1 tmb1 r/w h'78 h'ffb2 timer counter b1 tcb1 r h'00 h'ffb3 timer load register b1 tlb1 w h'00 h'ffb3 9.3.2 register descriptions timer mode register b1 (tmb1) bit 7 6 5 4 3 2 1 0 tmb17 ? ? ? ? tmb12 tmb11 tmb10 initial value 0 1 1 1 1 0 0 0 read/write r/w ? ? ? ? r/w r/w r/w tmb1 is an 8-bit read/write register for selecting the auto-reload function and input clock. upon reset, tmb1 is initialized to h'78. bit 7 ? ? ? ? auto-reload function select (tmb17): bit 7 selects whether timer b1 is used as an interval timer or auto-reload timer. bit 7: tmb17 description 0 interval timer function selected (initial value) 1 auto-reload function selected bits 6 to 3 ? ? ? ? reserved bits: bits 6 to 3 are reserved; they are always read as 1, and cannot be modified.
section 9 timers rev. 6.00 sep 12, 2006 page 212 of 526 rej09b0326-0600 bits 2 to 0 ? ? ? ? clock select (tmb12 to tmb10): bits 2 to 0 select the clock input to tcb1. for external event counting, either the rising or falling edge can be selected. bit 2: tmb12 bit 1: tmb11 bit 0: tmb10 description 0 0 0 internal clock: /8192 (initial value) 1 internal clock: /2048 1 0 internal clock: /512 1 internal clock: /256 1 0 0 internal clock: /64 1 internal clock: /16 1 0 internal clock: /4 1 external event (tmib): rising or falling edge * note: * the edge of the external event signal is selected by bit integ6 in interrupt edge select register 2 (iegr2). see section 3.3.2, interrupt control registers, for details. timer counter b1 (tcb1) bit 7 6 5 4 3 2 1 0 tcb17 tcb16 tcb15 tcb14 tcb13 tcb12 tcb11 tcb10 initial value 0 0 0 0 0 0 0 0 read/write r r r r r r r r tcb1 is an 8-bit read-only up-counter, which is incremented by internal clock or external event input. the clock source for input to this counter is selected by bits tmb12 to tmb10 in timer mode register b1 (tmb1). tcb1 values can be read by the cpu at any time. when tcb1 overflows from h'ff to h'00 or to the value set in tlb1, the irrtb1 bit in irr1 is set to 1. tcb1 is allocated to the same address as tlb1. upon reset, tcb1 is initialized to h'00.
section 9 timers rev. 6.00 sep 12, 2006 page 213 of 526 rej09b0326-0600 timer load register b1 (tlb1) bit 7 6 5 4 3 2 1 0 tlb17 tlb16 tlb15 tlb14 tlb13 tlb12 tlb11 tlb10 initial value 0 0 0 0 0 0 0 0 read/write w w w w w w w w tlb1 is an 8-bit write-only register for setting the reload value of timer counter b1 (tcb1). when a reload value is set in tlb1, the same value is loaded into timer counter b1 (tcb1) as well, and tcb1 starts counting up from that value. when tcb1 overflows during operation in auto-reload mode, the tlb1 value is loaded into tcb1. accordingly, overflow periods can be set within the range of 1 to 256 input clocks. the same address is allocated to tlb1 as to tcb1. upon reset, tlb1 is initialized to h'00. 9.3.3 timer operation interval timer operation: when bit tmb17 in timer mode register b1 (tmb1) is cleared to 0, timer b1 functions as an 8-bit interval timer. upon reset, tcb1 is cleared to h'00 and bit tmb17 is cleared to 0, so up-counting and interval timing resume immediately. the clock input to timer b1 is selected from seven internal clock signals output by prescaler s, or an external clock input at pin tmib. the selection is made by bits tmb12 to tmb10 of tmb1. after the count value in tcb1 reaches h'ff, the next clock signal input causes timer b1 to overflow, setting bit irrtb1 to 1 in interrupt request register 1 (irr1). if ientb1 = 1 in interrupt enable register 1 (ienr1), a cpu interrupt is requested.* at overflow, tcb1 returns to h'00 and starts counting up again. during interval timer operation (tmb17 = 0), when a value is set in timer load register b1 (tlb1), the same value is set in tcb1. note: * for details on interrupts, see section 3.3, interrupts.
section 9 timers rev. 6.00 sep 12, 2006 page 214 of 526 rej09b0326-0600 auto-reload timer operation: setting bit tmb17 in tmb1 to 1 causes timer b1 to function as an 8-bit auto-reload timer. when a reload value is set in tlb1, the same value is loaded into tcb1, becoming the value from which tcb1 starts its count. after the count value in tcb1 reaches h'ff, the next clock signal input causes timer b1 to overflow. the tlb1 value is then loaded into tcb1, and the count continues from that value. the overflow period can be set within a range from 1 to 256 input clocks, depending on the tlb1 value. the clock sources and interrupts in auto-reload mode are the same as in interval mode. in auto-reload mode (tmb17 = 1), when a new value is set in tlb1, the tlb1 value is also set in tcb1. event counter operation: timer b1 can operate as an event counter, counting rising or falling edges of an external event signal input at pin tmib. external event counting is selected by setting bits tmb12 to tmb10 in timer mode register b1 (tmb1) to all 1s (111). when timer b1 is used to count external event input, bit inten6 in ienr3 should be cleared to 0 to disable int 6 interrupt requests. 9.3.4 timer b1 operation states table 9.7 summarizes the timer b1 operation states. table 9.7 timer b1 operation states operation mode reset active sleep watch sub- active sub- sleep standby tcb1 interval reset functions functions halted halted halted halted auto reload reset functions functions halted halted halted halted tmb1 reset functions retained retained retained retained retained
section 9 timers rev. 6.00 sep 12, 2006 page 215 of 526 rej09b0326-0600 9.4 timer v 9.4.1 overview timer v is an 8-bit timer based on an 8-bit counter. timer v counts external events. also compare match signals can be used to reset the counter, request an interrupt, or output a pulse signal with an arbitrary duty cycle. counting can be initiated by a trigger input at the trgv pin, enabling pulse output control to be synchronized to the trigger, with an arbitrary delay from the trigger input. features features of timer v are given below. ? choice of six internal clock sources ( /128, /64, /32, /16, /8, /4) or an external clock (can be used as an external event counter). ? counter can be cleared by compare match a or b, or by an external reset signal. if the count stop function is selected, the counter can be halted when cleared. ? timer output is controlled by two independent compare match signals, enabling pulse output with an arbitrary duty cycle, pwm output, and other applications. ? three interrupt sources: two compare match, one overflow ? counting can be initiated by trigger input at the trgv pin. the rising edge, falling edge, or both edges of the trgv input can be selected.
section 9 timers rev. 6.00 sep 12, 2006 page 216 of 526 rej09b0326-0600 block diagram figure 9.3 shows a block diagram of timer v. trgv tmciv tmriv tmov cmia cmib ovi internal data bus trigger control comparator clock select comparator clear control interrupt request control output control time constant register a time constant register b timer counter v timer control/status register v timer control register v0 timer control register v1 prescaler s compare-match interrupt a compare-match interrupt b overflow interrupt legend: tcora: tcorb: tcntv: tcsrv: tcrv0: tcrv1: pss: cmia: cmib: ovi: pss tcrv1 tcorb tcntv tcora tcrv0 tcsrv figure 9.3 block diagram of timer v
section 9 timers rev. 6.00 sep 12, 2006 page 217 of 526 rej09b0326-0600 pin configuration table 9.8 shows the timer v pin configuration. table 9.8 pin configuration name abbr. i/o function timer v output tmov output timer v waveform output timer v clock input tmciv input clock input to tcntv timer v reset input tmriv input external input to reset tcntv trigger input trgv input trigger input to initiate counting register configuration table 9.9 shows the register configuration of timer v. table 9.9 timer v registers name abbr. r/w initial value address timer control register v0 tcrv0 r/w h'00 h'ffb8 timer control/status register v tcsrv r/(w) * h'10 h'ffb9 time constant register a tcora r/w h'ff h'ffba time constant register b tcorb r/w h'ff h'ffbb timer counter v tcntv r/w h'00 h'ffbc timer control register v1 tcrv1 r/w h'e2 h'ffbd note: * bits 7 to 5 can only be written with 0, for flag clearing.
section 9 timers rev. 6.00 sep 12, 2006 page 218 of 526 rej09b0326-0600 9.4.2 register descriptions timer counter v (tcntv) bit 7 6 5 4 3 2 1 0 tcntv 7 tcntv 6 tcntv 5 tcntv 4 tcntv 3 tcntv 2 tcntv 1 tcntv 0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w tcntv is an 8-bit read/write up-counter which is incremented by internal or external clock input. the clock source is selected by bits cks2 to cks0 in tcrv0. the tcntv value can be read and written by the cpu at any time. tcntv can be cleared by an external reset signal, or by compare match a or b. the clearing signal is selected by bits cclr1 and cclr0 in tcrv0. when tcntv overflows from h'ff to h'00, ovf is set to 1 in tcsrv. tcntv is initialized to h'00 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. time constant registers a and b (tcora, tcorb) bit 7 6 5 4 3 2 1 0 tcorn 7 tcorn 6 tcorn 5 tcorn 4 tcorn 3 tcorn 2 tcorn 1 tcorn 0 initial value 1 1 1 1 1 1 1 1 read/write r/w r/w r/w r/w r/w r/w r/w r/w n = a or b tcora and tcorb are 8-bit read/write registers. tcora and tcntv are compared at all times, except during the t 3 state of a tcora write cycle. when the tcora and tcntv contents match, cmfa is set to 1 in tcsrv. if cmiea is also set to 1 in tcrv0, a cpu interrupt is requested. timer output from the tmov pin can be controlled by a signal resulting from compare match, according to the settings of bits os3 to os0 in tcsrv. tcora is initialized to h'ff upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. tcorb is similar to tcora.
section 9 timers rev. 6.00 sep 12, 2006 page 219 of 526 rej09b0326-0600 timer control register v0 (tcrv0) bit 7 6 5 4 3 2 1 0 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w tcrv0 is an 8-bit read/write register that selects the tcntv input clock, controls the clearing of tcntv, and enables interrupts. tcrv0 is initialized to h'00 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. bit 7 ? ? ? ? compare match interrupt enable b (cmieb): bit 7 enables or disables the interrupt request (cmib) generated from cmfb when cmfb is set to 1 in tcsrv. bit 7: cmieb description 0 interrupt request (cmib) from cmfb disabled (initial value) 1 interrupt request (cmib) from cmfb enabled bit 6 ? ? ? ? compare match interrupt enable a (cmiea): bit 6 enables or disables the interrupt request (cmia) generated from cmfa when cmfa is set to 1 in tcsrv. bit 6: cmiea description 0 interrupt request (cmia) from cmfa disabled (initial value) 1 interrupt request (cmia) from cmfa enabled bit 5 ? ? ? ? timer overflow interrupt enable (ovie): bit 5 enables or disables the interrupt request (ovi) generated from ovf when ovf is set to 1 in tcsrv. bit 5: ovie description 0 interrupt request (ovi) from ovf disabled (initial value) 1 interrupt request (ovi) from ovf enabled bits 4 and 3 ? ? ? ? counter clear 1 and 0 (cclr1, cclr0): bits 4 and 3 specify whether or not to clear tcntv, and select compare match a or b or an external reset input. when clearing is specified, if trge is set to 1 in tcrv1, then when tcntv is cleared it is also halted. counting resumes when a trigger edge is input at the trgv pin.
section 9 timers rev. 6.00 sep 12, 2006 page 220 of 526 rej09b0326-0600 if trge is cleared to 0, after tcntv is cleared it continues counting up. bit 4: cclr1 bit 3: cclr0 description 0 0 clearing is disabled (initial value) 1 cleared by compare match a 1 0 cleared by compare match b 1 cleared by rising edge of external reset input bits 2 to 0 ? ? ? ? clock select 2 to 0 (cks2 to cks0): bits 2 to 0 and bit icks0 in tcrv1 select the clock input to tcntv. six internal clock sources divided from the system clock ( ) can be selected. the counter increments on the falling edge. if the external clock is selected, there is a further selection of incrementing on the rising edge, falling edge, or both edges. if trge is cleared to 0, after tcntv is cleared it continues counting up. tcrv0 tcrv1 bit 2: cks2 bit 1: cks1 bit 0: cks0 bit 0: icks0 description 0 0 0 ? clock input disabled (initial value) 1 0 internal clock: /4, falling edge 1 internal clock: /8, falling edge 1 0 0 internal clock: /16, falling edge 1 internal clock: /32, falling edge 1 0 internal clock: /64, falling edge 1 internal clock: /128, falling edge 1 0 0 ? clock input disabled 1 ? external clock: rising edge 1 0 ? external clock: falling edge 1 ? external clock: rising and falling edges
section 9 timers rev. 6.00 sep 12, 2006 page 221 of 526 rej09b0326-0600 timer control/status register v (tcsrv) bit 7 6 5 4 3 2 1 0 cmfb cmfa ovf ? os3 os2 os1 os0 initial value 0 0 0 1 0 0 0 0 read/write r/(w) * r/(w) * r/(w) * ? r/w r/w r/w r/w note: * bits 7 to 5 can be only written with 0, for flag clearing. tcsrv is an 8-bit register that sets compare match flags and the timer overflow flag, and controls compare match output. tcsrv is initialized to h'10 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. bit 7 ? ? ? ? compare match flag b (cmfb): bit 7 is a status flag indicating that tcntv has matched tcorb. this flag is set by hardware and cleared by software. it cannot be set by software. bit 7: cmfb description 0 clearing condition: after reading cmfb = 1, cleared by writing 0 to cmfb (initial value) 1 setting condition: set when the tcntv value matches the tcorb value bit 6 ? ? ? ? compare match flag a (cmfa): bit 6 is a status flag indicating that tcntv has matched tcora. this flag is set by hardware and cleared by software. it cannot be set by software. bit 6: cmfa description 0 clearing condition: after reading cmfa = 1, cleared by writing 0 to cmfa (initial value) 1 setting condition: set when the tcntv value matches the tcora value
section 9 timers rev. 6.00 sep 12, 2006 page 222 of 526 rej09b0326-0600 bit 5 ? ? ? ? timer overflow flag (ovf): bit 5 is a status flag indicating that tcntv has overflowed from h'ff to h'00. this flag is set by hardware and cleared by software. it cannot be set by software. bit 5: ovf description 0 clearing condition: after reading ovf = 1, cleared by writing 0 to ovf (initial value) 1 setting condition: set when tcntv overflows from h'ff to h'00 bit 4 ? ? ? ? reserved bit: bit 4 is reserved; it is always read as 1, and cannot be modified. bits 3 to 0 ? ? ? ? output select 3 to 0 (os3 to os0): bits 3 to 0 select the way in which the output level at the tmov pin changes in response to compare match between tcntv and tcora or tcorb. os3 and os2 select the output level for compare match b. os1 and os0 select the output level for compare match a. the two levels can be controlled independently. if two compare matches occur simultaneously, any conflict between the settings is resolved according to the following priority order: toggle output > 1 output > 0 output. when os3 to os0 are all cleared to 0, timer output is disabled. after a reset, the timer output is 0 until the first compare match. bit 3: os3 bit 2: os2 description 0 0 no change at compare match b (initial value) 1 0 output at compare match b 1 0 1 output at compare match b 1 output toggles at compare match b bit 1: os1 bit 0: os0 description 0 0 no change at compare match a (initial value) 1 0 output at compare match a 1 0 1 output at compare match a 1 output toggles at compare match a
section 9 timers rev. 6.00 sep 12, 2006 page 223 of 526 rej09b0326-0600 timer control register v1 (tcrv1) bit 7 6 5 4 3 2 1 0 ? ? ? tveg1 tveg0 trge ? icks0 initial value 1 1 1 0 0 0 1 0 read/write ? ? ? r/w r/w r/w ? r/w tcrv1 is an 8-bit read/write register that selects the valid edge at the trgv pin, enables trgv input, and selects the clock input to tcntv. tcrv1 is initialized to h'e2 upon reset and in watch mode, subsleep mode, and subactive mode. bits 7 to 5 ? ? ? ? reserved bits: bit 7 to 5 are reserved; they are always read as 1, and cannot be modified. bits 4 and 3 ? ? ? ? trgv input edge select (tveg1, tveg0): bits 4 and 3 select the trgv input edge. bit 4: tveg1 bit 3: tveg0 description 0 0 trgv trigger input is disabled (initial value) 1 rising edge is selected 1 0 falling edge is selected 1 rising and falling edges are both selected bit 2 ? ? ? ? trgv input enable (trge): bit 2 enables tcntv counting to be triggered by input at the trgv pin, and enables tcntv counting to be halted when tcntv is cleared by compare match. tcntv stops counting when trge is set to 1, then starts counting when the edge selected by bits tveg1 and tveg0 is input at the trgv pin. bit 2: trge description 0 tcntv counting is not triggered by input at the trgv pin, and does not stop when tcntv is cleared by compare match (initial value) 1 tcntv counting is triggered by input at the trgv pin, and stops when tcntv is cleared by compare match bit 1 ? ? ? ? reserved bit: bit 1 is reserved; it is always read as 1, and cannot be modified. bit 0 ? ? ? ? internal clock select 0 (icks0): bit 0 and bits cks2 to cks0 in tcrv0 select the tcntv clock source. for details see section 9.4.2, register descriptions.
section 9 timers rev. 6.00 sep 12, 2006 page 224 of 526 rej09b0326-0600 9.4.3 timer operation timer v operation: a reset initializes tcntv to h'00, tcora and tcorb to h'ff, tcrv0 to h'00, tcsrv to h'10, and tcrv1 to h'e2. timer v can be clocked by one of six internal clocks output from prescaler s, or an external clock, as selected by bits cks2 to cks0 in tcrv0 and bit icks0 in tcrv1. the valid edge or edges of the external clock can also be selected by cks2 to cks0. when the clock source is selected, tcntv starts counting the selected clock input. the tcntv contents are always compared with tcora and tcorb. when a match occurs, the cmfa or cmfb bit is set to 1 in tcsrv. if cmiea or cmieb is set to 1 in tcrv0, a cpu interrupt is requested. at the same time, the output level selected by bits os3 to os0 in tcsrv is output from the tmov pin. when tcnt overflows from h'ff to h'00, if ovie is 1 in tcrv0, a cpu interrupt is requested. if bits cclr1 and cclr0 in tcrv0 are set to 01 (clear by compare match a) or 10 (clear by compare match b), tcntv is cleared by the corresponding compare match. if these bits are set to 11, tcntv is cleared by input of a rising edge at the tmriv pin. when the counter clear event selected by bits cclr1 and cclr0 in tcrv0 occurs, tcntv is cleared and the count-up is halted. tcntv starts counting when the signal edge selected by bits tveg1 and tveg0 in tcrv1 is input at the trgv pin.
section 9 timers rev. 6.00 sep 12, 2006 page 225 of 526 rej09b0326-0600 tcntv increment timing: tcntv is incremented by an input (internal or external) clock. ? internal clock one of six clocks ( /128, /64, /32, /16, /8, /4) divided from the system clock ( ) can be selected by bits cks2 to cks0 in tcrv0 and bit icks0 in tcrv1. figure 9.4 shows the timing. n ? 1 tcntv input frc input tcntv internal clock n n ? 1 figure 9.4 increment timing with internal clock ? external clock incrementation on the rising edge, falling edge, or both edges of the external clock can be selected by bits cks2 to cks0 in tcrv0. the external clock pulse width should be at least 1.5 system clocks ( ) when a single edge is counted, and at least 2.5 system clocks when both edges are counted. shorter pulses will not be counted correctly. figure 9.5 shows the timing when both the rising and falling edges of the external clock are selected.
section 9 timers rev. 6.00 sep 12, 2006 page 226 of 526 rej09b0326-0600 n ? 1 n n ? 1 tcntv input clock figure 9.5 increment timing with external clock overflow flag set timing: the overflow flag (ovf) is set to 1 when tcntv overflows from h'ff to h'00. figure 9.6 shows the timing. h'ff h'00 overflow signal figure 9.6 ovf set timing
section 9 timers rev. 6.00 sep 12, 2006 page 227 of 526 rej09b0326-0600 compare match flag set timing: compare match flag a or b (cmfa or cmfb) is set to 1 when tcntv matches tcora or tcorb. the internal compare-match signal is generated in the last state in which the values match (when tcntv changes from the matching value to a new value). accordingly, when tcntv matches tcora or tcorb, the compare match signal is not generated until the next clock input to tcntv. figure 9.7 shows the timing. tcora or tcorb figure 9.7 cmfa and cmfb set timing tmov output timing: the tmov output responds to compare match a or b by remaining unchanged, changing to 0, changing to 1, or toggling, as selected by bits os3 to os0 in tcsrv. figure 9.8 shows the timing when the output is toggled by compare match a. timer v output pin figure 9.8 tmov output timing
section 9 timers rev. 6.00 sep 12, 2006 page 228 of 526 rej09b0326-0600 tcntv clear timing by compare match: tcntv can be cleared by compare match a or b, as selected by bits cclr1 and cclr0 in tcrv0. figure 9.9 shows the timing. tcntv figure 9.9 clear timing by compare match tcntv clear timing by tmriv: tcntv can be cleared by a rising edge at the tmriv pin, as selected by bits cclr1 and cclr0 in tcrv0. a tmriv input pulse width of at least 1.5 system clocks is necessary. figure 9.10 shows the timing. timer v output pin ? 1 n h'00 figure 9.10 clear timing by tmriv input
section 9 timers rev. 6.00 sep 12, 2006 page 229 of 526 rej09b0326-0600 9.4.4 timer v operation modes table 9.10 summarizes the timer v operation states. table 9.10 timer v operation states operation mode reset active sleep watch sub- active sub- sleep standby tcntv reset functions functions reset reset reset reset tcrv0, tcrv1 reset functions functions reset reset reset reset tcora, tcorb reset functions functions reset reset reset reset tcsrv reset functions functions reset reset reset reset 9.4.5 interrupt sources timer v has three interrupt sources: cmia, cmib, and ovi. table 9.11 lists the interrupt sources and their vector address. each interrupt source can be enabled or disabled by an interrupt enable bit in tcrv0. although all three interrupts share the same vector, they have individual interrupt flags, so software can discriminate the interrupt source. table 9.11 timer v interrupt sources interrupt description vector address cmia generated from cmfa h'0022 cmib generated from cmfb ovi generated from ovf 9.4.6 application examples pulse output with arbitrary duty cycle: figure 9.11 shows an example of output of pulses with an arbitrary duty cycle. to set up this output: ? clear bit cclr1 to 0 and set bit cclr0 to 1 in tcrv0 so that tcntv will be cleared by compare match with tcora. ? set bits os3 to os0 to 0110 in tcsrv so that the output will go to 1 at compare match with tcora and to 0 at compare match with tcorb. ? set bits cks2 to cks0 in tcrv0 and bit icks0 in tcrv1 to select the desired clock source.
section 9 timers rev. 6.00 sep 12, 2006 page 230 of 526 rej09b0326-0600 with these settings, a waveform is output without further software intervention, with a period determined by tcora and a pulse width determined by tcorb. tcntv counter cleared h'ff tcora tcorb h'00 tmov figure 9.11 pulse output example single-shot output with arbitrary pulse width and delay from trgv input: the trigger function can be used to output a pulse with an arbitrary pulse width at an arbitrary delay from the trgv input, as shown in figure 9.12. to set up this output: ? set bit cclr1 to 1 and clear bit cclr0 to 0 in tcrv0 so that tcntv will be cleared by compare match with tcorb. ? set bits os3 to os0 to 0110 in tcsrv so that the output will go to 1 at compare match with tcora and to 0 at compare match with tcorb. ? set bits tveg1 and tveg0 to 10 in tcrv1 and set trge to 1 to select the falling edge of the trgv input. ? set bits cks2 to cks0 in tcrv0 and bit icks0 in tcrv1 to select the desired clock source.
section 9 timers rev. 6.00 sep 12, 2006 page 231 of 526 rej09b0326-0600 after these settings, a pulse waveform will be output without further software intervention, with a delay determined by tcora from the trgv input, and a pulse width determined by (tcorb ? tcora). counter cleared tcntv compare match a compare match b clears tcntv and halts count-up compare match a compare match b clears tcntv and halts count-up h'ff tcorb tcora h'00 trgv tmov figure 9.12 pulse output synchronized to trgv input
section 9 timers rev. 6.00 sep 12, 2006 page 232 of 526 rej09b0326-0600 9.4.7 application notes the following types of contention can occur in timer v operation. contention between tcntv write and counter clear: if a tcntv clear signal is generated in the t 3 state of a tcntv write cycle, clearing takes precedence and the write to the counter is not carried out. figure 9.13 shows the timing. t 1 t 2 t 3 tcntv write cycle by cpu address tcntv address internal write signal figure 9.13 contention between tcntv write and clear
section 9 timers rev. 6.00 sep 12, 2006 page 233 of 526 rej09b0326-0600 contention between tcntv write and increment: if a tcntv increment clock signal is generated in the t 3 state of a tcntv write cycle, the write takes precedence and the counter is not incremented. figure 9.14 shows the timing. t 1 t 2 t 3 tcntv write cycle by cpu address internal write signal figure 9.14 contention between tcntv write and increment
section 9 timers rev. 6.00 sep 12, 2006 page 234 of 526 rej09b0326-0600 contention between tcor write and compare match: if a compare match is generated in the t 3 state of a tcora or tcorb write cycle, the write to tcora or tcorb takes precedence and the compare match signal is inhibited. figure 9.15 shows the timing. t 1 t 2 t 3 tcora write cycle by cpu address internal write signal figure 9.15 contention between tcora write and compare match
section 9 timers rev. 6.00 sep 12, 2006 page 235 of 526 rej09b0326-0600 contention between compare match a and b: if compare match a and b occur simultaneously, any conflict between the output selections for compare match a and compare match b is resolved by following the priority order in table 9.12. table 9.12 timer output priority order output setting priority toggle output high 1 output 0 output no change low internal clock switching and counter operation: depending on the timing, tcntv may be incremented by a switch between different internal clock sources. table 9.13 shows the relation between internal clock switchover timing (by writing to bits cks1 and cks0) and tcntv operation. when tcntv is internally clocked, an increment pulse is generated from the falling edge of an internal clock signal, which is divided from the system clock ( ). for this reason, in a case like no. 3 in table 9.13 where the switch is from a high clock signal to a low clock signal, the switchover is seen as a falling edge, causing tcntv to increment. tcntv can also be incremented by a switch between internal and external clocks.
section 9 timers rev. 6.00 sep 12, 2006 page 236 of 526 rej09b0326-0600 table 9.13 internal clock switching and tcntv operation no. clock levels before and after modifying bits cks1 and cks0 tcntv operation 1 goes from low level to low level * 1 n + 1 clock before switching clock after switching count clock tcntv write to cks1 and cks0 n 2 goes from low to high * 2 n + 1 n + 2 clock before switching clock after switching count clock tcntv write to cks1 and cks0 n
section 9 timers rev. 6.00 sep 12, 2006 page 237 of 526 rej09b0326-0600 no. clock levels before and after modifying bits cks1 and cks0 tcntv operation 3 goes from high level to low level * 3 n + 1 n n + 2 * 4 clock before switching clock after switching count clock tcntv write to cks1 and cks0 4 goes from high to high n + 1 n + 2 n clock before switching clock after switching count clock write to cks1 and cks0 tcntv notes: 1. including a transition from the low level to the stopped state, or from the stopped state to the low level. 2. including a transition from the stopped state to the high level. 3. including a transition from the high level to the stopped state. 4. the switchover is seen as a falling edge, and tcntv is incremented.
section 9 timers rev. 6.00 sep 12, 2006 page 238 of 526 rej09b0326-0600 9.5 timer x 9.5.1 overview timer x is based on a 16-bit free-running counter (frc). it can output two independent waveforms, or measure input pulse widths and external clock periods. features features of timer x are given below. ? choice of three internal clock sources ( /2, /8, /32) or an external clock (can be used as an external event counter). ? two independent output compare waveforms. ? four independent input capture channels, with selection of rising or falling edge and buffering option. ? counter can be cleared by compare match a. ? seven independent interrupt sources: two compare match, four input capture, one overflow
section 9 timers rev. 6.00 sep 12, 2006 page 239 of 526 rej09b0326-0600 block diagram figure 9.16 shows a block diagram of timer x. ftoa ftob timer interrupt enable register timer control/status register x free-running counter output compare register a output compare register b timer control register x timer output compare control register input capture register a input capture register b input capture register c input capture register d prescaler s legend: tier: tcsrx: frc: ocra: ocrb: tcrx: tocr: icra: icrb: icrc: icrd: pss: interrupt request input capture control internal data bus comparator comparator icra icrc icrb icrd tcrx ocrb ocra tocr frc tcsrx tier pss ftia ftib ftic ftid ftci figure 9.16 block diagram of timer x
section 9 timers rev. 6.00 sep 12, 2006 page 240 of 526 rej09b0326-0600 pin configuration table 9.14 shows the timer x pin configuration. table 9.14 pin configuration name abbr. i/o function counter clock input ftci input clock input to frc output compare a ftoa output output pin for output compare a output compare b ftob output output pin for output compare b input capture a ftia input input pin for input capture a input capture b ftib input input pin for input capture b input capture c ftic input input pin for input capture c input capture d ftid input input pin for input capture d
section 9 timers rev. 6.00 sep 12, 2006 page 241 of 526 rej09b0326-0600 register configuration table 9.15 shows the register configuration of timer x. table 9.15 timer x registers name abbr. r/w initial value address timer interrupt enable register tier r/w h'01 h'f770 timer control/status register x tcsrx r/(w) * 1 h'00 h'f771 free-running counter h frch r/w h'00 h'f772 free-running counter l frcl r/w h'00 h'f773 output compare register ah ocrah r/w h'ff h'f774 * 2 output compare register al ocral r/w h'ff h'f775 * 2 output compare register bh ocrbh r/w h'ff h'f774 * 2 output compare register bl ocrbl r/w h'ff h'f775 * 2 timer control register x tcrx r/w h'00 h'f776 timer output compare control register tocr r/w h'e0 h'f777 input capture register ah icrah r h'00 h'f778 input capture register al icral r h'00 h'f779 input capture register bh icrbh r h'00 h'f77a input capture register bl icrbl r h'00 h'f77b input capture register ch icrch r h'00 h'f77c input capture register cl icrcl r h'00 h'f77d input capture register dh icrdh r h'00 h'f77e input capture register dl icrdl r h'00 h'f77f notes: 1. bits 7 to 1 can only be written with 0 for flag clearing. bit 0 is a read/write bit. 2. ocra and ocrb share the same address. they are selected by the ocrs bit in tocr.
section 9 timers rev. 6.00 sep 12, 2006 page 242 of 526 rej09b0326-0600 9.5.2 register descriptions free-running counter (frc) free-running counter h (frch) free-running counter l (frcl) frc bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 read/write r/wr/w r/w r/wr/wr/wr/wr/wr/wr/wr/wr/wr/w r/w r/w r/w frch frcl frc is a 16-bit read/write up-counter, which is incremented by internal or external clock input. the clock source is selected by bits cks1 and cks0 in tcrx. frc can be cleared by compare match a, depending on the setting of cclra in tcsrx. when frc overflows from h'ffff to h'0000, ovf is set to 1 in tcsrx. if ovie = 1 in tier, a cpu interrupt is requested. frc can be written and read by the cpu. since frc has 16 bits, data is transferred between the cpu and frc via a temporary register (temp). for details see section 9.5.3, cpu interface. frc is initialized to h'0000 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. output compare registers a and b (ocra, ocrb) output compare registers ah and bh (ocrah, ocrbh) output compare registers al and bl (ocral, ocrbl) ocra, ocrb bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 read/write r/wr/w r/w r/wr/wr/wr/wr/wr/wr/wr/wr/wr/w r/w r/w r/w ocrah, ocrbh ocral, ocrbl
section 9 timers rev. 6.00 sep 12, 2006 page 243 of 526 rej09b0326-0600 there are two 16-bit read/write output compare registers, ocra and ocrb, the contents of which are always compared with frc. when the values match, ocfa or ocfb is set to 1 in tcsrx. if ociae = 1 or ocibe = 1 in tier, a cpu interrupt is requested. when a compare match with ocra or ocrb occurs, if oea = 1 or oeb = 1 in tocr, the value selected by olvla or olvlb in tocr is output at the ftoa or ftob pin. after a reset, the output from the ftoa or ftob pin is 0 until the first compare match occurs. ocra and ocrb can be written and read by the cpu. since they are 16-bit registers, data is transferred between them and the cpu via a temporary register (temp). for details see section 9.5.3, cpu interface. ocra and ocrb are initialized to h'ffff upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. input capture registers a to d (icra to icrd) input capture registers ah to dh (icrah to icrdh) input capture registers al to dl (icral to icrdl) icra, icrb, icrc, icrd bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 read/write r r r r r r r r r r r r r r r r icrah, icrbh, icrch, icrdh icral, icrbl, icrcl, icrdl there are four 16-bit read only input capture registers, icra to icrd. when the falling edge of an input capture signal is input, the frc value is transferred to the corresponding input capture register, and the corresponding input capture flag (icfa to icfd) is set to 1 in tcsrx. if the corresponding input capture interrupt enable bit (iciae to icide) is 1 in tcrx, a cpu interrupt is requested. the valid edge of the input signal can be selected by bits iedga to iedgd in tcrx. icrc and icrd can also be used as buffer registers for icra and icrb. buffering is enabled by bits bufea and bufeb in tcrx. figure 9.17 shows the interconnections when icrc operates as a buffer register of icra (when bufea = 1). when icrc is used as the icra buffer, both the rising and falling edges of the
section 9 timers rev. 6.00 sep 12, 2006 page 244 of 526 rej09b0326-0600 external input signal can be selected simultaneously, by setting iedga iedgc. if iedga = iedgc, then only one edge is selected (either the rising edge or falling edge). see table 9.16. note: the frc value is transferred to the input capture register (icr) regardless of the value of the input capture flag (icf). edge detector and internal capture signal generator icrc icra frc ftia ieoga bufea iedgc figure 9.17 buffer operation (example) table 9.16 input edge selection during buffer operation iedga iedgc input edge selection 0 0 falling edge of input capture a input signal is captured (initial value) 1 rising and falling edge of input capture a input signal are both captured 1 0 1 rising edge of input capture a input signal is captured icra to icrd can be written and read by the cpu. since they are 16-bit registers, data is transferred from them to the cpu via a temporary register (temp). for details see section 9.5.3, cpu interface. to assure input capture, the pulse width of the input capture input signal must be at least 1.5 system clocks ( ) when a single edge is selected, or at least 2.5 system clocks ( ) when both edges are selected. icra to icrd are initialized to h'0000 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode.
section 9 timers rev. 6.00 sep 12, 2006 page 245 of 526 rej09b0326-0600 timer interrupt enable register (tier) bit 7 6 5 4 3 2 1 0 iciae icibe icice icide ociae ocibe ovie ? initial value 0 0 0 0 0 0 0 1 read/write r/w r/w r/w r/w r/w r/w r/w ? tier is an 8-bit read/write register that enables or disables interrupt requests. tier is initialized to h'01 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. bit 7 ? ? ? ? input capture interrupt a enable (iciae): bit 7 enables or disables the icia interrupt requested when icfa is set to 1 in tcsrx. bit 7: iciae description 0 interrupt request by icfa (icia) is disabled (initial value) 1 interrupt request by icfa (icia) is enabled bit 6 ? ? ? ? input capture interrupt b enable (icibe): bit 6 enables or disables the icib interrupt requested when icfb is set to 1 in tcsrx. bit 6: icibe description 0 interrupt request by icfb (icib) is disabled (initial value) 1 interrupt request by icfb (icib) is enabled bit 5 ? ? ? ? input capture interrupt c enable (icice): bit 5 enables or disables the icic interrupt requested when icfc is set to 1 in tcsrx. bit 5: icice description 0 interrupt request by icfc (icic) is disabled (initial value) 1 interrupt request by icfc (icic) is enabled
section 9 timers rev. 6.00 sep 12, 2006 page 246 of 526 rej09b0326-0600 bit 4 ? ? ? ? input capture interrupt d enable (icide): bit 4 enables or disables the icid interrupt requested when icfd is set to 1 in tcsrx. bit 4: icide description 0 interrupt request by icfd (icid) is disabled (initial value) 1 interrupt request by icfd (icid) is enabled bit 3 ? ? ? ? output compare interrupt a enable (ociae): bit 3 enables or disables the ocia interrupt requested when ocfa is set to 1 in tcsrx. bit 3: ociae description 0 interrupt request by ocfa (ocia) is disabled (initial value) 1 interrupt request by ocfa (ocia) is enabled bit 2 ? ? ? ? output compare interrupt b enable (ocibe): bit 2 enables or disables the ocib interrupt requested when ocfb is set to 1 in tcsrx. bit 2: ocibe description 0 interrupt request by ocfb (ocib) is disabled (initial value) 1 interrupt request by ocfb (ocib) is enabled bit 1 ? ? ? ? timer overflow interrupt enable (ovie): bit 1 enables or disables the fovi interrupt requested when ovf is set to 1 in tcsrx. bit 1: ovie description 0 interrupt request by ovf (fovi) is disabled (initial value) 1 interrupt request by ovf (fovi) is enabled bit 0 ? ? ? ? reserved bit: bit 0 is reserved; it is always read as 1, and cannot be modified.
section 9 timers rev. 6.00 sep 12, 2006 page 247 of 526 rej09b0326-0600 timer control/status register x (tcsrx) bit 7 6 5 4 3 2 1 0 icfa icfb icfc icfd ocfa ocfb ovf cclra initial value 0 0 0 0 0 0 0 0 read/write r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/w note: * bits 7 to 1 can only be written with 0 for flag clearing. tcsrx is an 8-bit register that selects clearing of the counter and controls interrupt request signals. tcsrx is initialized to h'00 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. other timing is described in section 9.6.3, timer operation. bit 7 ? ? ? ? input capture flag a (icfa): bit 7 is a status flag that indicates that the frc value has been transferred to icra by an input capture signal. if bufea is set to 1 in tcrx, icfa indicates that the frc value has been transferred to icra by an input capture signal and that the icra value before this update has been transferred to icrc. this flag is set by hardware and cleared by software. it cannot be set by software. bit 7: icfa description 0 clearing condition: after reading icfa = 1, cleared by writing 0 to icfa (initial value) 1 setting condition: set when the frc value is transferred to icra by an input capture signal bit 6 ? ? ? ? input capture flag b (icfb): bit 6 is a status flag that indicates that the frc value has been transferred to icrb by an input capture signal. if bufeb is set to 1 in tcrx, icfb indicates that the frc value has been transferred to icrb by an input capture signal and that the icrb value before this update has been transferred to icrc. this flag is set by hardware and cleared by software. it cannot be set by software. bit 6: icfb description 0 clearing condition: after reading icfb = 1, cleared by writing 0 to icfb (initial value) 1 setting condition: set when the frc value is transferred to icrb by an input capture signal
section 9 timers rev. 6.00 sep 12, 2006 page 248 of 526 rej09b0326-0600 bit 5 ? ? ? ? input capture flag c (icfc): bit 5 is a status flag that indicates that the frc value has been transferred to icrc by an input capture signal. if bufea is set to 1 in tcrx, icfc is set by the input capture signal even though the frc value is not transferred to icrc. in buffered operation, icfc can accordingly be used as an external interrupt, by setting the icice bit to 1. this flag is set by hardware and cleared by software. it cannot be set by software. bit 5: icfc description 0 clearing condition: after reading icfc = 1, cleared by writing 0 to icfc (initial value) 1 setting condition: set by input capture signal bit 4 ? ? ? ? input capture flag d (icfd): bit 4 is a status flag that indicates that the frc value has been transferred to icrd by an input capture signal. if bufeb is set to 1 in tcrx, icfd is set by the input capture signal even though the frc value is not transferred to icrd. in buffered operation, icfd can accordingly be used as an external interrupt, by setting the icide bit to 1. this flag is set by hardware and cleared by software. it cannot be set by software. bit 4: icfd description 0 clearing condition: after reading icfd = 1, cleared by writing 0 to icfd (initial value) 1 setting condition: set by input capture signal bit 3 ? ? ? ? output compare flag a (ocfa): bit 3 is a status flag that indicates that the frc value has matched ocra. this flag is set by hardware and cleared by software. it cannot be set by software. bit 3: ocfa description 0 clearing condition: after reading ocfa = 1, cleared by writing 0 to ocfa (initial value) 1 setting condition: set when frc matches ocra
section 9 timers rev. 6.00 sep 12, 2006 page 249 of 526 rej09b0326-0600 bit 2 ? ? ? ? output compare flag b (ocfb): bit 2 is a status flag that indicates that the frc value has matched ocrb. this flag is set by hardware and cleared by software. it cannot be set by software. bit 2: ocfb description 0 clearing condition: after reading ocfb = 1, cleared by writing 0 to ocfb (initial value) 1 setting condition: set when frc matches ocrb bit 1 ? ? ? ? timer overflow flag (ovf): bit 1 is a status flag that indicates that frc has overflowed from h'ffff to h'0000. this flag is set by hardware and cleared by software. it cannot be set by software. bit 1: ovf description 0 clearing condition: after reading ovf = 1, cleared by writing 0 to ovf (initial value) 1 setting condition: set when the frc value overflows from h'ffff to h'0000 bit 0 ? ? ? ? counter clear a (cclra): bit 0 selects whether or not to clear frc by compare match a (when frc matches ocra). bit 0: cclra description 0 frc is not cleared by compare match a (initial value) 1 frc is cleared by compare match a
section 9 timers rev. 6.00 sep 12, 2006 page 250 of 526 rej09b0326-0600 timer control register x (tcrx) bit 7 6 5 4 3 2 1 0 iedga iedgb iedgc iedgd bufea bufeb cks1 cks0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w tcrx is an 8-bit read/write register that selects the valid edges of the input capture signals, enables buffering, and selects the frc clock source. tcrx is initialized to h'00 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. bit 7 ? ? ? ? input edge select a (iedga): bit 7 selects the rising or falling edge of the input capture a input signal (ftia). bit 7: iedga description 0 falling edge of input capture a is captured (initial value) 1 rising edge of input capture a is captured bit 6 ? ? ? ? input edge select b (iedgb): bit 6 selects the rising or falling edge of the input capture b input signal (ftib). bit 6: iedgb description 0 falling edge of input capture b is captured (initial value) 1 rising edge of input capture b is captured bit 5 ? ? ? ? input edge select c (iedgc): bit 5 selects the rising or falling edge of the input capture c input signal (ftic). bit 5: iedgc description 0 falling edge of input capture c is captured (initial value) 1 rising edge of input capture c is captured
section 9 timers rev. 6.00 sep 12, 2006 page 251 of 526 rej09b0326-0600 bit 4 ? ? ? ? input edge select d (iedgd): bit 4 selects the rising or falling edge of the input capture d input signal (ftid). bit 4: iedgd description 0 falling edge of input capture d is captured (initial value) 1 rising edge of input capture d is captured bit 3 ? ? ? ? buffer enable a (bufea): bit 3 selects whether or not to use icrc as a buffer register for icra. bit 3: bufea description 0 icrc is not used as a buffer register for icra (initial value) 1 icrc is used as a buffer register for icra bit 2 ? ? ? ? buffer enable b (bufeb): bit 2 selects whether or not to use icrd as a buffer register for icrb. bit 2: bufeb description 0 icrd is not used as a buffer register for icrb (initial value) 1 icrd is used as a buffer register for icrb bits 1 and 0 ? ? ? ? clock select (cks1, cks0): bits 1 and 0 select one of three internal clock sources or an external clock for input to frc. the external clock is counted on the rising edge. bit 1: cks1 bit 0: cks0 description 0 0 internal clock: /2 (initial value) 1 internal clock: /8 1 0 internal clock: /32 1 external clock: rising edge
section 9 timers rev. 6.00 sep 12, 2006 page 252 of 526 rej09b0326-0600 timer output compare control register (tocr) bit 7 6 5 4 3 2 1 0 ? ? ? ocrs oea oeb olvla olvlb initial value 1 1 1 0 0 0 0 0 read/write ? ? ? r/w r/w r/w r/w r/w tocr is an 8-bit read/write register that selects the output compare output levels, enables output compare output, and controls access to ocra and ocrb. tocr is initialized to h'e0 upon reset and in standby mode, watch mode, subsleep mode, and subactive mode. bits 7 to 5 ? ? ? ? reserved bits: bit 7 to 5 are reserved; they are always read as 1, and cannot be modified. bit 4 ? ? ? ? output compare register select (ocrs): ocra and ocrb share the same address. ocrs selects which register is accessed when this address is written or read. it does not affect the operation of ocra and ocrb. bit 4: ocrs description 0 ocra is selected (initial value) 1 ocrb is selected bit 3 ? ? ? ? output enable a (oea): bit 3 enables or disables the timer output controlled by output compare a. bit 3: oea description 0 output compare a output is disabled (initial value) 1 output compare a output is enabled bit 2 ? ? ? ? output enable b (oeb): bit 2 enables or disables the timer output controlled by output compare b. bit 2: oeb description 0 output compare b output is disabled (initial value) 1 output compare b output is enabled
section 9 timers rev. 6.00 sep 12, 2006 page 253 of 526 rej09b0326-0600 bit 1 ? ? ? ? output level a (olvla): bit 1 selects the output level that is output at pin ftoa by compare match a (when frc matches ocra). bit 1: olvla description 0 low level (initial value) 1 high level bit 0 ? ? ? ? output level b (olvlb): bit 0 selects the output level that is output at pin ftob by compare match b (when frc matches ocrb). bit 0: olvlb description 0 low level (initial value) 1 high level 9.5.3 cpu interface frc, ocra, ocrb, and icra to icrd are 16-bit registers, but the cpu is connected to the on- chip peripheral modules by an 8-bit data bus. when the cpu accesses these registers, it therefore uses an 8-bit temporary register (temp). these registers should always be accessed 16 bits at a time. if two consecutive byte-size mov instructions are used, the upper byte must be accessed first and the lower byte second. data will not be transferred correctly if only the upper byte or only the lower byte is accessed.
section 9 timers rev. 6.00 sep 12, 2006 page 254 of 526 rej09b0326-0600 write access: write access to the upper byte results in transfer of the upper-byte write data to temp. next, write access to the lower byte results in transfer of the data in temp to the upper register byte, and direct transfer of the lower-byte write data to the lower register byte. figure 9.18 shows an example of the writing of h'aa55 to frc. cpu (h'aa) write to upper byte write to lower byte cpu (h'55) bus interface bus interface module data bus module data bus temp (h'aa) frch ( ) frcl ( ) temp (h'aa) frch (h'aa) frcl (h'55) figure 9.18 write access to frc (cpu frc)
section 9 timers rev. 6.00 sep 12, 2006 page 255 of 526 rej09b0326-0600 read access: in access to frc and icra to icrd, when the upper byte is read the upper-byte data is transferred directly to the cpu and the lower-byte data is transferred to temp. next, when the lower byte is read, the lower-byte data in temp is transferred to the cpu. in access to ocra or ocrb, when the upper byte is read the upper-byte data is transferred directly to the cpu, and when the lower byte is read the lower-byte data is transferred directly to the cpu. figure 9.19 shows an example of the reading of frc when frc contains h'aaff. cpu (h'aa) read upper byte read lower byte cpu (h'ff) bus interface bus interface module data bus module data bus temp (h'ff) frch (h'aa) frcl (h'ff) temp (h'ff) frch ( ab ) frcl ( 00 ) note: h'ab00 if counter has been updated once. figure 9.19 read access to frc (frc cpu)
section 9 timers rev. 6.00 sep 12, 2006 page 256 of 526 rej09b0326-0600 9.5.4 timer operation timer x operation ? output compare operation following a reset, frc is initialized to h'0000 and starts counting up. bits cks1 and cks0 in tcrx can select one of three internal clock sources or an external clock for input to frc. the frc contents are compared constantly with ocra and ocrb. when a match occurs, the output at pin ftoa or ftob goes to the level selected by olvla or olvlb in tocr. following a reset, the output at both ftoa and ftob is 0 until the first compare match. if cclra is set to 1 in tcsrx, compare match a clears frc to h'0000. ? input capture operation following a reset, frc is initialized to h'0000 and starts counting up. bits cks1 and cks0 in tcrx can select one of three internal clock sources or an external clock for input to frc. when the edges selected by bits iedga to iedgd in tcrx are input at pins ftia to ftid, the frc value is transferred to icra to icrd, and icfa to icfd are set to 1 in tcsrx. if bits iciae to icide are set to 1 in tier, a cpu interrupt is requested. if bits bufea and bufeb are set to 1 in tcrx, icrc and icrd operate as buffer registers for icra or icrb. when the edges selected by bits iedga to iedgd in tcrx are input at pins ftia and ftib, the frc value is transferred to icra or icrb, and the previous value in icra or icrb is transferred to icrc or icrd. simultaneously, icfa or icfb is set to 1. if bit iciae or icibe is set to 1 in tier, a cpu interrupt is requested.
section 9 timers rev. 6.00 sep 12, 2006 page 257 of 526 rej09b0326-0600 frc count timing: frc is incremented by clock input. bits cks1 and cks0 in tcrx can select one of three internal clock sources ( /2, /8, /32) or an external clock. ? internal clock bits cks1 and cks0 in tcrx select one of three internal clock sources ( /2, /8, /32) created by dividing the system clock ( ). figure 9.20 shows the increment timing. n ? 1 frc input clock figure 9.20 increment timing with internal clock ? external clock external clock input is selected when bits cks1 and cks0 are both set to 1 in tcrx. frc increments on the rising edge of the external clock. an external pulse width of at least 1.5 system clocks ( ) is necessary. shorter pulses will not be counted correctly. figure 9.21 shows the timing. n ? 1 n frc input clock figure 9.21 increment timing with external clock
section 9 timers rev. 6.00 sep 12, 2006 page 258 of 526 rej09b0326-0600 output compare timing: when a compare match occurs, the output level selected by the olvl bit in tocr is output at pin ftoa or ftob. figure 9.22 shows the output timing for output compare a. n + 1 n n + 1 n nn ocra * note: * by execution of a software instruction. figure 9.22 output compare a output timing frc clear timing: frc can be cleared by compare match a. figure 9.23 shows the timing. n h'0000 frc figure 9.23 clear timing by compare match a
section 9 timers rev. 6.00 sep 12, 2006 page 259 of 526 rej09b0326-0600 input capture timing ? input capture timing the rising or falling edge is selected for input capture by bits iedga to iedgd in tcrx. figure 9.24 shows the timing when the rising edge is selected (iedga/b/c/d = 1). input capture signal figure 9.24 input capture signal timing (normal case) if the input at the input capture pin occurs while the upper byte of the corresponding input capture register (icra to icrd) is being read, the internal input capture signal is delayed by one system clock ( ). figure 9.25 shows the timing. input capture signal figure 9.25 input capture signal timing (during icra to icrd read)
section 9 timers rev. 6.00 sep 12, 2006 page 260 of 526 rej09b0326-0600 ? buffered input capture timing input capture can be buffered by using icrc or icrd as a buffer for icra or icrb. figure 9.26 shows the timing when icra is buffered by icrc (bufea = 1) and both the rising and falling edges are selected (iedga = 1 and iedgc = 0, or iedga = 0 and iedgc = 1). n n + 1 n n + 1 mn nn mm mn figure 9.26 buffered input capture timing (normal case) when icrc or icrd is used as a buffer register, the input capture flag is still set by the selected edge of the input capture input signal. for example, if icrc is used to buffer icra, when the edge transition selected by the iedgc bit occurs at the input capture pin, icfc will be set, and if the iciec bit is set, an interrupt will be requested. the frc value will not be transferred to icrc, however. in buffered operation, if the upper byte of one of the two registers that receives a data transfer (icra and icrc, or icrb and icrd) is being read when an input capture signal would normally occur, the input capture signal will be delayed by one system clock ( ). figure 9.27 shows the case when bufea = 1.
section 9 timers rev. 6.00 sep 12, 2006 page 261 of 526 rej09b0326-0600 input capture signal figure 9.27 buffered input capture signal timing (during icra or icrd read) input capture flag (icfa to icfd) set timing: figure 9.28 shows the timing when an input capture flag (icfa to icfd) is set to 1 and the frc value is transferred to the corresponding input capture register (icra to icrd). icfa to icfd figure 9.28 icfa to icfd set timing
section 9 timers rev. 6.00 sep 12, 2006 page 262 of 526 rej09b0326-0600 output compare flag (ocfa or ocfb) set timing: ocfa and ocfb are set to 1 by internal compare match signals that are output when frc matches ocra or ocrb. the compare match signal is generated in the last state during which the values match (when frc is updated from the matching value to a new value). when frc matches ocra or ocrb, the compare match signal is not generated until the next counter clock. figure 9.29 shows the ocfa and ocfb set timing. ocra, ocrb figure 9.29 ocfa and ocfb set timing overflow flag (ovf) set timing: ovf is set to 1 when frc overflows from h'ffff to h'0000. figure 9.30 shows the timing. h'ffff h'0000 overflow signal figure 9.30 ovf set timing
section 9 timers rev. 6.00 sep 12, 2006 page 263 of 526 rej09b0326-0600 9.5.5 timer x operation modes table 9.17 shows the timer x operation modes. table 9.17 timer x operation modes operation mode reset active sleep watch sub- active sub- sleep standby frc reset functions functions reset reset reset reset ocra, ocrb reset functions functions reset reset reset reset icra to icrd reset functions functions reset reset reset reset tier reset functions functions reset reset reset reset tcrx reset functions functions reset reset reset reset tocr reset functions functions reset reset reset reset tcsrx reset functions functions reset reset reset reset 9.5.6 interrupt sources timer x has three types of interrupts and seven interrupt sources: icia to icid, ocia, ocib, and fovi. table 9.18 lists the sources of interrupt requests. each interrupt source can be enabled or disabled by an interrupt enable bit in tier. although all seven interrupts share the same vector, they have individual interrupt flags, so software can discriminate the interrupt source. table 9.18 timer x interrupt sources interrupt description vector address icia interrupt requested by icfa h'0020 icib interrupt requested by icfb icic interrupt requested by icfc icid interrupt requested by icfd ocia interrupt requested by ocfa ocib interrupt requested by ocfb fovi interrupt requested by ovf
section 9 timers rev. 6.00 sep 12, 2006 page 264 of 526 rej09b0326-0600 9.5.7 timer x application example figure 9.31 shows an example of the output of pulse signals with a 50% duty cycle and arbitrary phase offset. to set up this output: ? set bit cclra to 1 in tcsrx. ? have software invert the olvla and olvlb bits at each corresponding compare match. frc counter cleared h'ffff ocra ocrb h'0000 ftoa ftob figure 9.31 pulse output example
section 9 timers rev. 6.00 sep 12, 2006 page 265 of 526 rej09b0326-0600 9.5.8 application notes the following types of contention can occur in timer x operation. 1. contention between frc write and counter clear if an frc clear signal is generated in the t 3 state of a write cycle to the lower byte of frc, clearing takes precedence and the write to the counter is not carried out. figure 9.32 shows the timing. t 1 t 2 t 3 frc lower byte write cycle address frc address internal write signal figure 9.32 contention between frc write and clear
section 9 timers rev. 6.00 sep 12, 2006 page 266 of 526 rej09b0326-0600 2. contention between frc write and increment if an frc increment clock signal is generated in the t 3 state of a write cycle to the lower byte of frc, the write takes precedence and the counter is not incremented. figure 9.33 shows the timing. t 1 t 2 t 3 frc lower byte write cycle address internal write signal figure 9.33 contention between frc write and increment
section 9 timers rev. 6.00 sep 12, 2006 page 267 of 526 rej09b0326-0600 3. contention between ocr write and compare match if a compare match is generated in the t 3 state of a write cycle to the lower byte of ocra or ocrb, the write to ocra or ocrb takes precedence and the compare match signal is inhibited. figure 9.34 shows the timing. t 1 t 2 t 3 ocr lower byte write cycle address internal write signal figure 9.34 contention between ocr write and compare match
section 9 timers rev. 6.00 sep 12, 2006 page 268 of 526 rej09b0326-0600 4. internal clock switching and counter operation depending on the timing, frc may be incremented by a switch between different internal clock sources. table 9.19 shows the relation between internal clock switchover timing (by writing to bits cks1 and cks0) and frc operation. when frc is internally clocked, an increment pulse is generated from the falling edge of an internal clock signal, which is divided from the system clock ( ). for this reason, in a case like no. 3 in table 9.19 where the switch is from a high clock signal to a low clock signal, the switchover is seen as a falling edge, causing frc to increment. frc can also be incremented by a switch between internal and external clocks. table 9.19 internal clock switching and frc operation no. clock levels before and after modifying bits cks1 and cks0 frc operation 1 goes from low level to low level n + 1 clock before switching clock after switching count clock frc write to cks1 and cks0 n 2 goes from low to high n + 1 n + 2 clock before switching clock after switching count clock frc write to cks1 and cks0 n
section 9 timers rev. 6.00 sep 12, 2006 page 269 of 526 rej09b0326-0600 no. clock levels before and after modifying bits cks1 and cks0 frc operation 3 goes from high level to low level n + 1 n n + 2 * clock before switching clock after switching count clock frc write to cks1 and cks0 4 goes from high to high n + 1 n + 2 n clock before switching clock after switching count clock write to cks1 and cks0 frc note: * the switchover is seen as a falling edge, and frc is incremented.
section 9 timers rev. 6.00 sep 12, 2006 page 270 of 526 rej09b0326-0600 9.6 watchdog timer 9.6.1 overview the watchdog timer has an 8-bit counter that is incremented by an input clock. if a system runaway allows the counter value to overflow before being rewritten, the watchdog timer can reset the chip internally. features features of the watchdog timer are given below. ? incremented by internal clock source ( /8192). ? a reset signal is generated when the counter overflows. the overflow period can be set from 1 to 256 times 8192/ (from approximately 2 ms to 500 ms when = 4.19 mhz). block diagram figure 9.35 shows a block diagram of the watchdog timer. pss tcsrw tcw figure 9.35 block diagram of watchdog timer
section 9 timers rev. 6.00 sep 12, 2006 page 271 of 526 rej09b0326-0600 register configuration table 9.20 shows the register configuration of the watchdog timer. table 9.20 watchdog timer registers name abbr. r/w initial value address timer control/status register w tcsrw r/w h'aa h'ffbe timer counter w tcw r/w h'00 h'ffbf 9.6.2 register descriptions timer control/status register w (tcsrw) bit 7 6 5 4 3 2 1 0 b6wi tcwe b4wi tcsrwe b2wi wdon b0wi wrst initial value 1 0 1 0 1 0 1 0 read/write r r/(w) * r r/(w) * r r/(w) * r r/(w) * note: * write is permitted only under certain conditions, which are given in the descriptions of the individual bits. tcsrw is an 8-bit read/write register that controls write access to tcw and tcsrw itself, controls watchdog timer operations, and indicates operating status. bit 7 ? ? ? ? bit 6 write inhibit (b6wi): bit 7 controls the writing of data to bit 6 in tcsrw. this bit is always read as 1. data written to this bit is not stored. bit 7: b6wi description 0 bit 6 is write-enabled 1 bit 6 is write-protected (initial value) bit 6 ? ? ? ? timer counter w write enable (tcwe): bit 6 controls the writing of data to bit 8 to tcw. bit 6: tcwe description 0 data cannot be written to tcw (initial value) 1 data can be written to tcw
section 9 timers rev. 6.00 sep 12, 2006 page 272 of 526 rej09b0326-0600 bit 5 ? ? ? ? bit 4 write inhibit (b4wi): bit 5 controls the writing of data to bit 4 in tcsrw. this bit is always read as 1. data written to this bit is not stored. bit 5: b4wi description 0 bit 4 is write-enabled 1 bit 4 is write-protected (initial value) bit 4 ? ? ? ? timer control/status register w write enable (tcsrwe): bit 4 controls the writing of data to tcsrw bits 2 and 0. bit 4: tcsrwe description 0 data cannot be written to bits 2 and 0 (initial value) 1 data can be written to bits 2 and 0 bit 3 ? ? ? ? bit 2 write inhibit (b2wi): bit 3 controls the writing of data to bit 2 in tcsrw. this bit is always read as 1. data written to this bit is not stored. bit 3: b2wi description 0 bit 2 is write-enabled 1 bit 2 is write-protected (initial value) bit 2 ? ? ? ? watchdog timer on (wdon): bit 2 enables watchdog timer operation. counting starts when this bit is set to 1, and stops when this bit is cleared to 0. bit 2: wdon description 0 watchdog timer operation is disabled (initial value) clearing condition: reset, or when tcsrwe = 1 and 0 is written in both b2wi and wdon 1 watchdog timer operation is enabled setting condition: when tcsrwe = 1 and 0 is written in b2wi and 1 is written in wdon
section 9 timers rev. 6.00 sep 12, 2006 page 273 of 526 rej09b0326-0600 bit 1 ? ? ? ? bit 0 write inhibit (b0wi): bit 1 controls the writing of data to bit 0 in tcsrw. this bit is always read as 1. data written to this bit is not stored. bit 1: b0wi description 0 bit 0 is write-enabled 1 bit 0 is write-protected (initial value) bit 0 ? ? ? ? watchdog timer reset (wrst): bit 0 indicates that tcw has overflowed, generating an internal reset signal. the internal reset signal generated by the overflow resets the entire chip. wrst is cleared to 0 by a reset from the res pin, or when software writes 0. bit 0: wrst description 0 clearing conditions: (initial value) ? reset by res pin ? when tcsrwe = 1, and 0 is written in both b0wi and wrst 1 setting condition: when tcw overflows and an internal reset signal is generated timer counter w (tcw) bit 7 6 5 4 3 2 1 0 tcw7 tcw6 tcw5 tcw4 tcw3 tcw2 tcw1 tcw0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w tcw is an 8-bit read/write up-counter, which is incremented by internal clock input. the input clock is /8192. the tcw value can always be written or read by the cpu. when tcw overflows from h'ff to h'00, an internal reset signal is generated and wrst is set to 1 in tcsrw. upon reset, tcw is initialized to h'00.
section 9 timers rev. 6.00 sep 12, 2006 page 274 of 526 rej09b0326-0600 9.6.3 timer operation the watchdog timer has an 8-bit counter (tcw) that is incremented by clock input ( /8192). when tcsrwe = 1 in tcsrw, if 0 is written in b2wi and 1 is simultaneously written in wdon, tcw starts counting up (two write accesses to tcsrw are necessary in order to operate the watchdog timer). when the tcw count value reaches h'ff, the next clock input causes the watchdog timer to overflow and generates an internal reset signal. the internal reset signal is output for 512 clock cycles of the osc clock. it is possible to write to tcw, causing tcw to count up from the written value. the overflow period can be set in the range from 1 to 256 input clocks, depending on the value written in tcw. figure 9.36 shows an example of watchdog timer operations. example: = 4 mhz and the desired overflow period is 30 ms. 4 ? 3 = 14.6 the value set in tcw should therefore be 256 ? 15 = 241 (h'f1). h'f1 tcw overflow start h'f1 written in tcw h'f1 written in tcw reset internal reset signal 512 figure 9.36 typical watchdog timer operations (example)
section 9 timers rev. 6.00 sep 12, 2006 page 275 of 526 rej09b0326-0600 9.6.4 watchdog timer operation states table 9.21 summarizes the watchdog timer operation states. table 9.21 watchdog timer operation states operation mode reset active sleep watch sub- active sub- sleep standby tcw reset functions functions halted halted halted halted tcsrw reset functions functions retained retained retained retained
section 9 timers rev. 6.00 sep 12, 2006 page 276 of 526 rej09b0326-0600
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 277 of 526 rej09b0326-0600 section 10 serial communication interface 10.1 overview the h8/3644 group is provided with a two-channel serial communication interface (sci). table 10.1 summarizes the functions and features of the two sci channels. table 10.1 serial communication interface functions channel functions features sci1 synchronous serial transfer ? choice of 8-bit or 16-bit data length ? continuous clock output ? choice of 8 internal clocks ( /1024 to /2) or external clock ? open drain output possible ? interrupt requested at completion of transfer sci3 synchronous serial transfer ? 8-bit data length ? send, receive, or simultaneous send/receive asynchronous serial transfer ? multiprocessor communication ? choice of 7-bit or 8-bit data length ? choice of 1 or 2 stop bits ? parity addition ? on-chip baud rate generator ? receive error detection ? break detection ? interrupt requested at completion of transfer or error 10.2 sci1 10.2.1 overview serial communication interface 1 (sci1) performs synchronous serial transfer of 8-bit or 16-bit data. ssb (synchronized serial bus) communication is also provided, enabling multiple ics to be controlled.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 278 of 526 rej09b0326-0600 features ? choice of 8-bit or 16-bit data length ? choice of eight internal clock sources ( /1024, /256, /64, /32, /16, /8, /4, /2) or an external clock ? interrupt requested at completion of transfer ? choice of hold mode or latch mode in ssb mode. block diagram figure 10.1 shows a block diagram of sci1. sck 1 si 1 so 1 scr1 scsr1 sdru sdrl pss transfer bit counter transmit/receive control circuit internal data bus legend: scr1: scsr1: sdru: sdrl: irrs1: pss: serial control register 1 serial control/status register 1 serial data register u serial data register l sci1 interrupt request flag prescaler s irrs1 figure 10.1 sci1 block diagram
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 279 of 526 rej09b0326-0600 pin configuration table 10.2 shows the sci1 pin configuration. table 10.2 pin configuration name abbr. i/o function sci1 clock pin sck 1 i/o sci1 clock input or output sci1 data input pin si 1 input sci1 receive data input sci1 data output pin so 1 output sci1 transmit data output register configuration table 10.3 shows the sci1 register configuration. table 10.3 sci1 registers name abbr. r/w initial value address serial control register 1 scr1 r/w h'00 h'ffa0 serial control status register 1 scsr1 r/w h'9c h'ffa1 serial data register u sdru r/w undefined h'ffa2 serial data register l sdrl r/w undefined h'ffa3 10.2.2 register descriptions serial control register 1 (scr1) bit 7 6 5 4 3 2 1 0 snc1 snc0 mrkon ltch cks3 cks2 cks1 cks0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w scr1 is an 8-bit read/write register for selecting the operation mode, the transfer clock source, and the prescaler division ratio. upon reset, scr1 is initialized to h'00. writing to this register during a transfer stops the transfer.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 280 of 526 rej09b0326-0600 bits 7 and 6 ? ? ? ? operation mode select 1, 0 (snc1, snc0): bits 7 and 6 select the operation mode. bit 7: snc1 bit 6: snc0 description 0 0 8-bit synchronous transfer mode (initial value) 1 16-bit synchronous transfer mode 1 0 continuous clock output mode * 1 1 reserved * 2 notes: 1. pins si 1 and so 1 should be used as general input or output ports. 2. don?t set bits snc1 and snc0 to 11. bits 5 ? ? ? ? tail mark control (mrkon): bit 5 controls tail mark output after an 8- or 16- bit data transfer. bit 5: mrkon description 0 tail mark is not output (synchronous mode) (initial value) 1 tail mark is output (ssb mode) bits 4 ? ? ? ? latch tail select (ltch): bit 4 selects whether latch tail or hold tail is output as tail mark when bit mrkon is set to 1 (ssb mode). bit 4: ltch description 0 hold tail is output (initial value) 1 latch tail is output bit 3 ? ? ? ? clock source select (cks3): bit 3 selects the clock source and sets pin sck 1 as an input or output pin. bit 3: cks3 description 0 clock source is prescaler s, and pin sck 1 is output pin (initial value) 1 clock source is external clock, and pin sck 1 is input pin
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 281 of 526 rej09b0326-0600 bits 2 to 0 ? ? ? ? clock select (cks2 to cks 0): when cks3 = 0, bits 2 to 0 select the prescaler division ratio and the serial clock cycle. serial clock cycle bit 2: cks2 bit 1: cks1 bit 0: cks0 prescaler division = 5 mhz = 2.5 mhz 0 0 0 /1024 (initial value) 204.8 s 409.6 s 1 /256 51.2 s 102.4 s 1 0 /64 12.8 s 25.6 s 1 /32 6.4 s 12.8 s 1 0 0 /16 3.2 s 6.4 s 1 /8 1.6 s 3.2 s 1 0 /4 0.8 s 1.6 s 1 /2 ? 0.8 s serial control/status register 1 (scsr1) bit 7 6 5 4 3 2 1 0 ? sol orer ? ? ? mtrf stf initial value 1 0 0 1 1 1 0 0 read/write ? r/w r/(w) * ? ? ? r r/w note: * only a write of 0 for flag clearing is possible. scsr1 is an 8-bit register indicating operation status and error status. upon reset, scsr1 is initialized to h'9c. bit 7 ? ? ? ? reserved bit: bit 7 is reserved; it is always read as 1, and cannot be modified.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 282 of 526 rej09b0326-0600 bit 6 ? ? ? ? extended data bit (sol): bit 6 sets the so 1 output level. when read, sol returns the output level at the so 1 pin. after completion of a transmission, so 1 continues to output the value of the last bit of transmitted data. the so 1 output can be changed by writing to sol before or after a transmission. the sol bit setting remains valid only until the start of the next transmission. ssb mode settings also become invalid. to control the level of the so 1 pin after transmission ends, it is necessary to write to the sol bit at the end of each transmission. do not write to this register while transmission is in progress, because that may cause a malfunction. bit 6: sol description 0 read: so 1 pin output level is low (initial value) write: so 1 pin output level changes to low 1 read: so 1 pin output level is high write: so 1 pin output level changes to high bit 5 ? ? ? ? overrun error flag (orer): when an external clock is used, bit 5 indicates the occurrence of an overrun error. if noise occurs during a transfer, causing an extraneous pulse to be superimposed on the normal serial clock, incorrect data may be transferred. if a clock pulse is input after transfer completion, this bit is set to 1 indicating an overrun. bit 5: orer description 0 clearing condition: after reading orer = 1, cleared by writing 0 to orer (initial value) 1 setting condition: set if a clock pulse is input after transfer is complete, when an external clock is used bits 4 to 2 ? ? ? ? reserved bits: bits 4 to 2 are reserved. they are always read as 0, and cannot be modified. bit 1 ? ? ? ? tail mark transmit flag (mtrf): when bit mrkon is set to 1, bit 1 indicates that tail mark is being sent. bit 1 is a read-only bit and cannot be modified. bit 1: mtrf description 0 idle state, or 8- or 16-bit data is being transferred (initial value) 1 tail mark is being sent
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 283 of 526 rej09b0326-0600 bit 0 ? ? ? ? start flag (stf): bit 0 controls the start of a transfer. setting this bit to 1 causes sci1 to start transferring data. during the transfer or while waiting for the first clock pulse, this bit remains set to 1. it is cleared to 0 upon completion of the transfer. it can therefore be used as a busy flag. bit 0: stf description 0 read: indicates that transfer is stopped (initial value) write: invalid 1 read: indicates transfer in progress write: starts a transfer operation serial data register u (sdru) bit 7 6 5 4 3 2 1 0 sdru7 sdru6 sdru5 sdru4 sdru3 sdru2 sdru1 sdru0 initial value undefined undefined undefined undefined undefined undefined undefined undefined read/write r/w r/w r/w r/w r/w r/w r/w r/w sdru is an 8-bit read/write register. it is used as the data register for the upper 8 bits in 16-bit transfer (sdrl is used for the lower 8 bits). data written to sdru is output to sdrl starting from the least significant bit (lsb). this data is then replaced by lsb-first data input at pin si1, which is shifted in the direction from the most significant bit (msb) toward the lsb. sdru must be written or read only after data transmission or reception is complete. if this register is written or read while a data transfer is in progress, the data contents are not guaranteed. the sdru value upon reset is undefined. serial data register l (sdrl) bit 7 6 5 4 3 2 1 0 sdrl7 sdrl6 sdrl5 sdrl4 sdrl3 sdrl2 sdrl1 sdrl0 initial value undefined undefined undefined undefined undefined undefined undefined undefined read/write r/w r/w r/w r/w r/w r/w r/w r/w
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 284 of 526 rej09b0326-0600 sdrl is an 8-bit read/write register. it is used as the data register in 8-bit transfer, and as the data register for the lower 8 bits in 16-bit transfer (sdru is used for the upper 8 bits). in 8-bit transfer, data written to sdrl is output from pin so 1 starting from the least significant bit (lsb). this data is then replaced by lsb-first data input at pin si 1 , which is shifted in the direction from the most significant bit (msb) toward the lsb. in 16-bit transfer, operation is the same as for 8-bit transfer, except that input data is fed in via sdru. sdrl must be written or read only after data transmission or reception is complete. if this register is read or written while a data transfer is in progress, the data contents are not guaranteed. the sdrl value upon reset is undefined. 10.2.3 operation in synchronous mode data can be sent and received in an 8-bit or 16-bit format, with an internal or external clock selected as the clock source. overrun errors can be detected when an external clock is used. clock: the serial clock can be selected from a choice of eight internal clocks and an external clock. when an internal clock source is selected, pin sck 1 becomes the clock output pin. when continuous clock output mode is selected (scr1 bits snc1 and snc0 are set to 10), the clock signal ( /1024 to /2) selected in bits cks2 to cks0 is output continuously from pin sck 1 . when an external clock is used, pin sck 1 is the clock input pin. data transfer format: figure 10.2 shows the data transfer format. data is sent and received starting from the least significant bit, in lsb-first format. transmit data is output from one falling edge of the serial clock until the next rising edge. receive data is latched at the rising edge of the serial clock. sck so /si 1 11 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 figure 10.2 transfer format
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 285 of 526 rej09b0326-0600 data transfer operations transmitting: a transmit operation is carried out as follows. 1. set bits so1 and sck1 to 1 in pmr3 to select the so 1 and sck 1 pin functions. if necessary, set bit pof1 in pmr7 for nmos open-drain output at pin so 1 . 2. clear bit snc1 in scr1 to 0, set bit snc0 to 0 or 1, and clear bit mrkon to 0, designating 8- or 16-bit synchronous transfer mode. select the serial clock in bits cks3 to cks0. writing data to scr1 when bit mrkon in scr1 is cleared to 0 initializes the internal state of sci1. 3. write transmit data in sdrl and sdru, as follows. 8-bit transfer mode: sdrl 16-bit transfer mode: upper byte in sdru, lower byte in sdrl 4. set the scsr1 start flag (stf) to 1. sci1 starts operating and outputs transmit data at pin so 1 . 5. after data transmission is complete, bit irrs1 in interrupt request register 2 (irr2) is set to 1. when an internal clock is used, a serial clock is output from pin sck 1 in synchronization with the transmit data. after data transmission is complete, the serial clock is not output until the next time the start flag is set to 1. during this time, pin so 1 continues to output the value of the last bit transmitted. when an external clock is used, data is transmitted in synchronization with the serial clock input at pin sck 1 . after data transmission is complete, an overrun occurs if the serial clock continues to be input; no data is transmitted and the scsr1 overrun error flag (bit orer) is set to 1. while transmission is stopped, the output value of pin so 1 can be changed by rewriting bit sol in scsr1. receiving: a receive operation is carried out as follows. 1. set bits si1 and sck1 to 1 in pmr3 to select the si 1 and sck 1 pin functions. 2. clear bit snc1 in scr1 to 0, set bit snc0 to 0 or 1, and clear bit mrkon to 0, designating 8- or 16-bit synchronous transfer mode. select the serial clock in bits cks3 to cks0. writing data to scr1 when bit mrkon in scr1 is cleared to 0 initializes the internal state of sci1. 3. set the scsr1 start flag (stf) to 1. sci1 starts operating and receives data at pin si 1 . 4. after data reception is complete, bit irrs1 in interrupt request register 2 (irr2) is set to 1. 5. read the received data from sdrl and sdru, as follows. 8-bit transfer mode: sdrl 16-bit transfer mode: upper byte in sdru, lower byte in sdrl
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 286 of 526 rej09b0326-0600 6. after data reception is complete, an overrun occurs if the serial clock continues to be input; no data is received and the scsr1 overrun error flag (bit orer) is set to 1. simultaneous transmit/receive: a simultaneous transmit/receive operation is carried out as follows. 1. set bits so1, si1, and sck1 to 1 in pmr3 to select the so 1 , si 1 , and sck 1 pin functions. if necessary, set bit pof1 in pmr7 for nmos open-drain output at pin so 1 . 2. clear bit snc1 in scr1 to 0, set bit snc0 to 0 or 1, and clear bit mrkon to 0, designating 8- or 16-bit synchronous transfer mode. select the serial clock in bits cks3 to cks0. writing data to scr1 when bit mrkon in scr1 is cleared to 0 initializes the internal state of sci1. 3. write transmit data in sdrl and sdru, as follows. 8-bit transfer mode: sdrl 16-bit transfer mode: upper byte in sdru, lower byte in sdrl 4. set the scsr1 start flag (stf) to 1. sci1 starts operating. transmit data is output at pin so 1 . receive data is input at pin si 1 . 5. after data transmission and reception are complete, bit irrs1 in irr2 is set to 1. 6. read the received data from sdrl and sdru, as follows. 8-bit transfer mode: sdrl 16-bit transfer mode: upper byte in sdru, lower byte in sdrl when an internal clock is used, a serial clock is output from pin sck 1 in synchronization with the transmit data. after data transmission is complete, the serial clock is not output until the next time the start flag is set to 1. during this time, pin so 1 continues to output the value of the last bit transmitted. when an external clock is used, data is transmitted and received in synchronization with the serial clock input at pin sck 1 . after data transmission and reception are complete, an overrun occurs if the serial clock continues to be input; no data is transmitted or received and the scsr1 overrun error flag (bit orer) is set to 1. while transmission is stopped, the output value of pin so 1 can be changed by rewriting bit sol in scsr1.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 287 of 526 rej09b0326-0600 10.2.4 operation in ssb mode ssb communication uses two lines, scl (serial clock) and sda (serial data), and enables multiple ics to be connected as shown in figure 10.3. in ssb mode, tail mark is sent after an 8- or 16-bit data transfer. hold tail or latch tail can be selected as tail mark. h8/3644 group sck so scl sda 1 1 scl sda ic-a scl sda ic-b scl sda ic-c figure 10.3 example of ssb connection clock: the transfer clock can be selected from eight internal clocks or an external clock, but since the h8/3644 group uses clock output, an external clock should not be selected. the transfer rate can be selected by bits cks2 to cks0 in scr1. since this is also the tail mark transfer rate, the setting should be made to give a transfer clock cycle of at least 2 s. data transfer format: figure 10.4 shows the sci1 transfer format. data is sent starting from the least significant bit, in lsb-first format. tail mark is sent after an 8- or 16-bit data transfer. sck 1 1 so bit 1 bit 0 bit 2 bit 3 bit 4 bit 14 bit 5 bit 15 tail mark 1 frame figure 10.4 transfer format (when snc1 = 0, snc0 = 1, mrkon = 1)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 288 of 526 rej09b0326-0600 tail mark: tail mark can be either hold tail or latch tail. the output waveforms of hold tail and latch tail are shown in figure 10.5. time t in the figure is determined by the transfer clock cycle set in bits cks2 to cks0 in scr1. sck 1 1 so bit 14 ttt t 2t bit 15 < hold tail > bit 0 tt sck 1 1 so bit 14 ttt t 2t bit 15 < latch tail > t figure 10.5 hold tail and latch tail waveforms transmitting: a transmit operation is carried out as follows. 1. set bit sol in scsr1 to 1. 2. set bits so1 and sck1 to 1 in pmr3 to select the s0 1 and sck 1 pin functions. set bit pof1 in pmr7 to 1 for nmos open-drain output at pin so 1 . 3. clear bit snc1 in scr1 to 0 and set bit snc0 to 0 or 1, designating 8-bit mode or 16-bit mode. set bit mrkon in scr1 to 1, selecting ssb mode. 4. write transmit data in sdrl and sdru as follows, and select tail mark with bit ltch in scr1. 8-bit mode: sdrl 16-bit mode: upper byte in sdru, lower byte in sdrl 5. set the scsr1 start flag (stf) to 1. sci1 starts operating and outputs transmit data at pin s0 1 . 6. after 8- or 16-bit data transmission is complete, bit stf in scsr1 is cleared to 0 and bit irrs1 in interrupt request register 2 (irrs2) is set to 1. the selected tail mark is output after the data transmission. during tail mark output, bit mtrf in scsr1 is set to 1. data can be sent continuously by repeating steps 4 to 6. check that sci1 is in the idle state before rewriting bit mrkon in scr1.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 289 of 526 rej09b0326-0600 10.2.5 interrupts sci1 can generate an interrupt at the end of a data transfer. when an sci1 transfer is complete, bit irrs1 in interrupt request register 2 (irr2) is set to 1. sci1 interrupt requests can be enabled or disabled by bit iens1 of interrupt enable register 2 (ienr2). for further details, see section 3.3, interrupts. 10.3 sci3 10.3.1 overview serial communication interface 3 (sci3) can carry out serial data communication in either asynchronous or synchronous mode. it is also provided with a multiprocessor communication function that enables serial data to be transferred among processors. features features of sci3 are listed below. ? choice of asynchronous or synchronous mode for serial data communication ? asynchronous mode serial data communication is performed asynchronously, with synchronization provided character by character. in this mode, serial data can be exchanged with standard asynchronous communication lsis such as a universal asynchronous receiver/transmitter (uart) or asynchronous communication interface adapter (acia). a multiprocessor communication function is also provided, enabling serial data communication among processors. there is a choice of 12 data transfer formats. data length 7 or 8 bits stop bit length 1 or 2 bits parity even, odd, or none multiprocessor bit ?1? or ?0? receive error detection parity, overrun, and framing errors break detection break detected by reading the rxd pin level directly when a framing error occurs
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 290 of 526 rej09b0326-0600 ? synchronous mode serial data communication is synchronized with a clock. in his mode, serial data can be exchanged with another lsi that has a synchronous communication function. data length 8 bits receive error detection overrun errors ? full-duplex communication separate transmission and reception units are provided, enabling transmission and reception to be carried out simultaneously. the transmission and reception units are both double-buffered, allowing continuous transmission and reception. ? on-chip baud rate generator, allowing any desired bit rate to be selected ? choice of an internal or external clock as the transmit/receive clock source ? six interrupt sources: transmit end, transmit data empty, receive data full, overrun error, framing error, and parity error
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 291 of 526 rej09b0326-0600 block diagram figure 10.6 shows a block diagram of sci3. clock txd rxd sck 3 brr smr scr3 ssr tdr rdr tsr rsr transmit/receive control circuit internal data bus legend: rsr: rdr: tsr: tdr: smr: scr3: ssr: brr: brc: receive shift register receive data register transmit shift register transmit data register serial mode register serial control register 3 serial status register bit rate register bit rate counter interrupt request (tei, txi, rxi, eri) internal clock ( /64, /16, /4, ) external clock brc baud rate generator figure 10.6 sci3 block diagram
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 292 of 526 rej09b0326-0600 pin configuration table 10.4 shows the sci3 pin configuration. table 10.4 pin configuration name abbr. i/o function sci3 clock sck 3 i/o sci3 clock input/output sci3 receive data input rxd input sci3 receive data input sci3 transmit data output txd output sci3 transmit data output register configuration table 10.5 shows the sci3 register configuration. table 10.5 registers name abbr. r/w initial value address serial mode register smr r/w h'00 h'ffa8 bit rate register brr r/w h'ff h'ffa9 serial control register 3 scr3 r/w h'00 h'ffaa transmit data register tdr r/w h'ff h'ffab serial status register ssr r/w h'84 h'ffac receive data register rdr r h'00 h'ffad transmit shift register tsr protected ? ? receive shift register rsr protected ? ? bit rate counter brc protected ? ? 10.3.2 register descriptions receive shift register (rsr) bit 7 6 5 4 3 2 1 0 read/write ? ? ? ? ? ? ? ?
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 293 of 526 rej09b0326-0600 rsr is a register used to receive serial data. serial data input to rsr from the rxd pin is set in the order in which it is received, starting from the lsb (bit 0), and converted to parallel data. when one byte of data is received, it is transferred to rdr automatically. rsr cannot be read or written directly by the cpu. receive data register (rdr) bit 7 6 5 4 3 2 1 0 rdr7 rdr6 rdr5 rdr4 rdr3 rdr2 rdr1 rdr0 initial value 0 0 0 0 0 0 0 0 read/write r r r r r r r r rdr is an 8-bit register that stores received serial data. when reception of one byte of data is finished, the received data is transferred from rsr to rdr, and the receive operation is completed. rsr is then enabled for reception. rsr and rdr are double-buffered, allowing consecutive receive operations. rdr is a read-only register, and cannot be written by the cpu. rdr is initialized to h'00 upon reset, and in standby, watch, subactive, or subsleep mode. transmit shift register (tsr) bit 7 6 5 4 3 2 1 0 read/write ? ? ? ? ? ? ? ? tsr is a register used to transmit serial data. transmit data is first transferred from tdr to tsr, and serial data transmission is carried out by sending the data to the txd pin in order, starting from the lsb (bit 0). when one byte of data is transmitted, the next byte of transmit data is transferred from tdr to tsr, and transmission started, automatically. data transfer from tdr to tsr is not performed if no data has been written to tdr (if bit tdre is set to 1 in the serial status register (ssr)). tsr cannot be read or written directly by the cpu.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 294 of 526 rej09b0326-0600 transmit data register (tdr) bit 7 6 5 4 3 2 1 0 tdr7 tdr6 tdr5 tdr4 tdr3 tdr2 tdr1 tdr0 initial value 1 1 1 1 1 1 1 1 read/write r/w r/w r/w r/w r/w r/w r/w r/w tdr is an 8-bit register that stores transmit data. when tsr is found to be empty, the transmit data written in tdr is transferred to tsr, and serial data transmission is started. continuous transmission is possible by writing the next transmit data to tdr during tsr serial data transmission. tdr can be read or written by the cpu at any time. tdr is initialized to h'ff upon reset, and in standby, watch, subactive, or subsleep mode. serial mode register (smr) bit 7 6 5 4 3 2 1 0 com chr pe pm stop mp cks1 cks0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w smr is an 8-bit register used to set the serial data transfer format and to select the clock source for the baud rate generator. smr can be read or written by the cpu at any time. smr is initialized to h'00 upon reset, and in standby, watch, subactive, or subsleep mode. bit 7 ? ? ? ? communication mode (com): bit 7 selects whether sci3 operates in asynchronous mode or synchronous mode. bit 7: com description 0 asynchronous mode (initial value) 1 synchronous mode
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 295 of 526 rej09b0326-0600 bit 6 ? ? ? ? character length (chr): bit 6 selects either 7 or 8 bits as the data length to be used in asynchronous mode. in synchronous mode the data length is always 8 bits, irrespective of the bit 6 setting. bit 6: chr description 0 8-bit data (initial value) 1 7-bit data * note: * when 7-bit data is selected, the msb (bit 7) of tdr is not transmitted. bit 5 ? ? ? ? parity enable (pe): bit 5 selects whether a parity bit is to be added during transmission and checked during reception in asynchronous mode. in synchronous mode parity bit addition and checking is not performed, irrespective of the bit 5 setting. bit 5: pe description 0 parity bit addition and checking disabled (initial value) 1 parity bit addition and checking enabled * note: * when pe is set to 1, even or odd parity, as designated by bit pm, is added to transmit data before it is sent, and the received parity bit is checked against the parity designated by bit pm. bit 4 ? ? ? ? parity mode (pm): bit 4 selects whether even or odd parity is to be used for parity addition and checking. the pm bit setting is only valid in asynchronous mode when bit pe is set to 1, enabling parity bit addition and checking. the pm bit setting is invalid in synchronous mode, and in asynchronous mode if parity bit addition and checking is disabled. bit 4: pm description 0 even parity * 1 (initial value) 1 odd parity * 2 notes: 1. when even parity is selected, a parity bit is added in transmission so that the total number of 1 bits in the transmit data plus the parity bit is an even number; in reception, a check is carried out to confirm that the number of 1 bits in the receive data plus the parity bit is an even number. 2. when odd parity is selected, a parity bit is added in transmission so that the total number of 1 bits in the transmit data plus the parity bit is an odd number; in reception, a check is carried out to confirm that the number of 1 bits in the receive data plus the parity bit is an odd number.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 296 of 526 rej09b0326-0600 bit 3 ? ? ? ? stop bit length (stop): bit 3 selects 1 bit or 2 bits as the stop bit length is asynchronous mode. the stop bit setting is only valid in asynchronous mode. when synchronous mode is selected the stop bit setting is invalid since stop bits are not added. bit 3: stop description 0 1 stop bit * 1 (initial value) 1 2 stop bits * 2 notes: 1. in transmission, a single 1 bit (stop bit) is added at the end of a transmit character. 2. in transmission, two 1 bits (stop bits) are added at the end of a transmit character. in reception, only the first of the received stop bits is checked, irrespective of the stop bit setting. if the second stop bit is 1 it is treated as a stop bit, but if 0, it is treated as the start bit of the next transmit character. bit 2 ? ? ? ? multiprocessor mode (mp): bit 2 enables or disables the multiprocessor communication function. when the multiprocessor communication function is enabled, the parity settings in the pe and pm bits are invalid. the mp bit setting is only valid in asynchronous mode. when synchronous mode is selected the mp bit should be set to 0. for details on the multiprocessor communication function, see section 10.3.6, multiprocessor communication function. bit 2: mp description 0 multiprocessor communication function disabled (initial value) 1 multiprocessor communication function enabled bits 1 and 0 ? ? ? ? clock select 1, 0 (cks1, cks0): bits 1 and 0 choose /64, /16, /4, or as the clock source for the baud rate generator. for the relation between the clock source, bit rate register setting, and baud rate, see bit rate register (brr). bit 1: cks1 bit 0: cks0 description 0 0 clock (initial value) 1 /4 clock 1 0 /16 clock 1 /64 clock
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 297 of 526 rej09b0326-0600 serial control register 3 (scr3) bit 7 6 5 4 3 2 1 0 tie rie te re mpie teie cke1 cke0 initial value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w scr3 is an 8-bit register for selecting transmit or receive operation, the asynchronous mode clock output, interrupt request enabling or disabling, and the transmit/receive clock source. scr3 can be read or written by the cpu at any time. scr3 is initialized to h'00 upon reset, and in standby, watch, subactive, or subsleep mode. bit 7 ? ? ? ? transmit interrupt enable (tie): bit 7 selects enabling or disabling of the transmit data empty interrupt request (txi) when transmit data is transferred from the transmit data register (tdr) to the transmit shift register (tsr), and bit tdre in the serial status register (ssr) is set to 1. txi can be released by clearing bit tdre or bit tie to 0. bit 7: tie description 0 transmit data empty interrupt request (txi) disabled (initial value) 1 transmit data empty interrupt request (txi) enabled bit 6 ? ? ? ? receive interrupt enable (rie): bit 6 selects enabling or disabling of the receive data full interrupt request (rxi) and the receive error interrupt request (eri) when receive data is transferred from the receive shift register (rsr) to the receive data register (rdr), and bit rdrf in the serial status register (ssr) is set to 1. there are three kinds of receive error: overrun, framing, and parity. rxi and eri can be released by clearing bit rdrf or the fer, per, or oer error flag to 0, or by clearing bit rie to 0. bit 6: rie description 0 receive data full interrupt request (rxi) and receive error interrupt request (eri) disabled (initial value) 1 receive data full interrupt request (rxi) and receive error interrupt request (eri) enabled
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 298 of 526 rej09b0326-0600 bit 5 ? ? ? ? transmit enable (te): bit 5 selects enabling or disabling of the start of transmit operation. bit 5: te description 0 transmit operation disabled * 1 (txd pin is transmit data pin) * 3 (initial value) 1 transmit operation enabled * 2 (txd pin is transmit data pin) * 3 notes: 1. bit tdre in ssr is fixed at 1. 2. when transmit data is written to tdr in this state, bit tdr in ssr is cleared to 0 and serial data transmission is started. be sure to carry out serial mode register (smr) settings to decide the transmission format before setting bit te to 1. 3. when bit txd in pmr7 is set to 1. when bit txd is cleared to 0, the txd pin functions as an i/o port regardless of the te bit setting. bit 4 ? ? ? ? receive enable (re): bit 4 selects enabling or disabling of the start of receive operation. bit 4: re description 0 receive operation disabled * 1 (rxd pin is i/o port) (initial value) 1 receive operation enabled * 2 (rxd pin is receive data pin) notes: 1. note that the rdrf, fer, per, and oer flags in ssr are not affected when bit re is cleared to 0, and retain their previous state. 2. in this state, serial data reception is started when a start bit is detected in asynchronous mode or serial clock input is detected in synchronous mode. be sure to carry out serial mode register (smr) settings to decide the reception format before setting bit re to 1. bit 3 ? ? ? ? multiprocessor interrupt enable (mpie): bit 3 selects enabling or disabling of the multiprocessor interrupt request. the mpie bit setting is only valid when asynchronous mode is selected and reception is carried out with bit mp in smr set to 1. the mpie bit setting is invalid when bit com is set to 1 or bit mp is cleared to 0. bit 3: mpie description 0 multiprocessor interrupt request disabled (normal receive operation) (initial value) clearing condition: when data is received in which the multiprocessor bit is set to 1 1 multiprocessor interrupt request enabled * note: * receive data transfer from rsr to rdr, receive error detection, and setting of the rdrf, fer, and oer status flags in ssr is not performed. rxi, eri, and setting of the rdrf, fer, and oer flags in ssr, are disabled until data with the multiprocessor bit set to 1 is received. when a receive character with the multiprocessor bit set to 1 is received, bit mpbr in ssr is set to 1, bit mpie is automatically cleared to 0, and rxi and eri requests (when bits tie and rie in serial control register (scr) are set to 1) and setting of the rdrf, fer, and oer flags are enabled.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 299 of 526 rej09b0326-0600 bit 2 ? ? ? ? transmit end interrupt enable (teie): bit 2 selects enabling or disabling of the transmit end interrupt request (tei) if there is no valid transmit data in tdr when msb data is to be sent. bit 2: teie description 0 transmit end interrupt request (tei) disabled (initial value) 1 transmit end interrupt request (tei) enabled * note: * tei can be released by clearing bit tdre to 0 and clearing bit tend to 0 in ssr, or by clearing bit teie to 0. bits 1 and 0 ? ? ? ? clock enable 1 and 0 (cke1, cke0): bits 1 and 0 select the clock source and enabling or disabling of clock output from the sck 3 pin. these bits determine whether the sck 3 pin functions as an i/o port, a clock output pin, or a clock input pin. the cke0 bit setting is only valid in case of internal clock operation (cke1 = 0) in asynchronous mode. in synchronous mode, or when external clock operation is used (cke1 = 1), bit cke0 should be cleared to 0. after setting bits cke1 and cke0, set the operating mode in the serial mode register (smr). for details on clock source selection, see table 10.10 in 10.3.3, operation. description bit 1: cke1 bit 0: cke0 communication mode clock source sck 3 pin function 0 0 asynchronous internal clock i/o port * 1 synchronous internal clock serial clock output * 1 1 asynchronous internal clock clock output * 2 synchronous reserved 1 0 asynchronous external clock clock input * 3 synchronous external clock serial clock input 1 asynchronous reserved synchronous reserved notes: 1. initial value 2. a clock with the same frequency as the bit rate is output. 3. input a clock with a frequency 16 times the bit rate.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 300 of 526 rej09b0326-0600 serial status register (ssr) bit 7 6 5 4 3 2 1 0 tdre rdrf oer fer per tend mpbr mpbt initial value 1 0 0 0 0 1 0 0 read/write r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r r r/w note: * only a write of 0 for flag clearing is possible. ssr is an 8-bit register containing status flags that indicate the operational status of sci3, and multiprocessor bits. ssr can be read or written by the cpu at any time, but only a write of 1 is possible to bits tdre, rdrf, oer, per, and fer. in order to clear these bits by writing 0, 1 must first be read. bits tend and mpbr are read-only bits, and cannot be modified. ssr is initialized to h'84 upon reset, and in standby, watch, subactive, or subsleep mode. bit 7 ? ? ? ? transmit data register empty (tdre): bit 7 indicates that transmit data has been transferred from tdr to tsr. bit 7: tdre description 0 transmit data written in tdr has not been transferred to tsr clearing conditions: ? after reading tdre = 1, cleared by writing 0 to tdre ? when data is written to tdr by an instruction 1 transmit data has not been written to tdr, or transmit data written in tdr has been transferred to tsr setting conditions: ? when bit te in scr3 is cleared to 0 ? when data is transferred from tdr to tsr (initial value)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 301 of 526 rej09b0326-0600 bit 6 ? ? ? ? receive data register full (rdrf): bit 6 indicates that received data is stored in rdr. bit 6: rdrf description 0 there is no receive data in rdr (initial value) clearing conditions: ? after reading rdrf = 1, cleared by writing 0 to rdrf ? when rdr data is read by an instruction 1 there is receive data in rdr setting condition: when reception ends normally and receive data is transferred from rsr to rdr note: if an error is detected in the receive data, or if the re bit in scr3 has been cleared to 0, rdr and bit rdrf are not affected and retain their previous state. note that if data reception is completed while bit rdrf is still set to 1, an overrun error (oer) will result and the receive data will be lost. bit 5 ? ? ? ? overrun error (oer): bit 5 indicates that an overrun error has occurred during reception. bit 5: oer description 0 reception in progress or completed * 1 (initial value) clearing condition: after reading oer = 1, cleared by writing 0 to oer 1 an overrun error has occurred during reception * 2 setting condition: when reception is completed with rdrf set to 1 notes: 1. when bit re in scr3 is cleared to 0, bit oer is not affected and retains its previous state. 2. rdr retains the receive data it held before the overrun error occurred, and data received after the error is lost. reception cannot be continued with bit oer set to 1, and in synchronous mode, transmission cannot be continued either.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 302 of 526 rej09b0326-0600 bit 4 ? ? ? ? framing error (fer): bit 4 indicates that a framing error has occurred during reception in asynchronous mode. bit 4: fer description 0 reception in progress or completed * 1 (initial value) clearing condition: after reading fer = 1, cleared by writing 0 to fer 1 a framing error has occurred during reception * 2 setting condition: when the stop bit at the end of the receive data is checked for a value of 1 at the end of reception, and the stop bit is 0 * 2 notes: 1. when bit re in scr3 is cleared to 0, bit fer is not affected and retains its previous state. 2. note that, in 2-stop-bit mode, only the first stop bit is checked for a value of 1, and the second stop bit is not checked. when a framing error occurs the receive data is transferred to rdr but bit rdrf is not set. reception cannot be continued with bit fer set to 1. in synchronous mode, neither transmission nor reception is possible when bit fer is set to 1. bit 3 ? ? ? ? parity error (per): bit 3 indicates that a parity error has occurred during reception with parity added in asynchronous mode. bit 3: per description 0 reception in progress or completed * 1 (initial value) clearing condition: after reading per = 1, cleared by writing 0 to per 1 a parity error has occurred during reception * 2 setting condition: when the number of 1 bits in the receive data plus parity bit does not match the parity designated by bit pm in the serial mode register (smr) notes: 1. when bit re in scr3 is cleared to 0, bit per is not affected and retains its previous state. 2. receive data in which it a parity error has occurred is still transferred to rdr, but bit rdrf is not set. reception cannot be continued with bit per set to 1. in synchronous mode, neither transmission nor reception is possible when bit per is set to 1.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 303 of 526 rej09b0326-0600 bit 2 ? ? ? ? transmit end (tend): bit 2 indicates that bit tdre is set to 1 when the last bit of a transmit character is sent. bit 2 is a read-only bit and cannot be modified. bit 2: tend description 0 transmission in progress clearing conditions: ? after reading tdre = 1, cleared by writing 0 to tdre ? when data is written to tdr by an instruction 1 transmission ended (initial value) setting conditions: ? when bit te in scr3 is cleared to 0 ? when bit tdre is set to 1 when the last bit of a transmit character is sent bit 1 ? ? ? ? multiprocessor bit receive (mpbr): bit 1 stores the multiprocessor bit in a receive character during multiprocessor format reception in asynchronous mode. bit 1 is a read-only bit and cannot be modified. bit 1: mpbr description 0 data in which the multiprocessor bit is 0 has been received * (initial value) 1 data in which the multiprocessor bit is 1 has been received note: * when bit re is cleared to 0 in scr3 with the multiprocessor format, bit mpbr is not affected and retains its previous state. bit 0 ? ? ? ? multiprocessor bit transfer (mpbt): bit 0 stores the multiprocessor bit added to transmit data when transmitting in asynchronous mode. the bit mpbt setting is invalid when synchronous mode is selected, when the multiprocessor communication function is disabled, and when not transmitting. bit 0: mpbt description 0 a 0 multiprocessor bit is transmitted (initial value) 1 a 1 multiprocessor bit is transmitted
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 304 of 526 rej09b0326-0600 bit rate register (brr) bit 7 6 5 4 3 2 1 0 brr7 brr6 brr5 brr4 brr3 brr2 brr1 brr0 initial value 1 1 1 1 1 1 1 1 read/write r/w r/w r/w r/w r/w r/w r/w r/w brr is an 8-bit register that designates the transmit/receive bit rate in accordance with the baud rate generator operating clock selected by bits cks1 and cks0 of the serial mode register (smr). brr can be read or written by the cpu at any time. brr is initialized to h'ff upon reset, and in standby, watch, subactive, or subsleep mode. table 10.6 shows examples of brr settings in asynchronous mode. the values shown are for active (high-speed) mode. table 10.6 examples of brr settings for various bit rates (asynchronous mode) osc (mhz) 2 2.4576 4 4.194304 bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 1 70 +0.03 1 86 +0.31 1 141 +0.03 1 148 ?0.04 150 0 207 +0.16 0 255 0 1 103 +0.16 1 108 +0.21 300 0 103 +0.16 0 127 0 0 207 +0.16 0 217 +0.21 600 0 51 +0.16 0 63 0 0 103 +0.16 0 108 +0.21 1200 0 25 +0.16 0 31 0 0 51 +0.16 0 54 ?0.70 2400 0 12 +0.16 0 15 0 0 25 +0.16 0 26 +1.14 4800 ? ? ? 0 7 0 0 12 +0.16 0 13 ?2.48 9600 ? ? ? 0 3 0 ? ? ? 0 6 ?2.48 19200 ? ? ? 0 1 0 ? ? ? ? ? ? 31250 0 0 0 ? ? ? 0 1 0 ? ? ? 38400 ? ? ? 0 0 0 ? ? ? ? ? ?
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 305 of 526 rej09b0326-0600 osc (mhz) 4.9152 6 7.3728 8 bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 1 174 ?0.26 1 212 +0.03 2 64 +0.70 2 70 +0.03 150 1 127 0 1 155 +0.16 1 191 0 1 207 +0.16 300 0 255 0 1 77 +0.16 1 95 0 1 103 +0.16 600 0 127 0 0 155 +0.16 0 191 0 0 207 +0.16 1200 0 63 0 0 77 +0.16 0 95 0 0 103 +0.16 2400 0 31 0 0 38 +0.16 0 47 0 0 51 +0.16 4800 0 15 0 0 19 ?2.34 0 23 0 0 25 +0.16 9600 0 7 0 0 9 ?2.34 0 11 0 0 12 +0.16 19200 0 3 0 0 4 ?2.34 0 5 0 ? ? ? 31250 ? ? ? 0 2 0 ? ? ? 0 3 0 38400 0 1 0 ? ? ? 0 2 0 ? ? ? osc (mhz) 9.8304 10 bit rate (bits/s) n n error (%) n n error (%) 110 2 86 +0.31 2 88 ?0.25 150 1 255 0 2 64 +0.16 300 1 127 0 1 129 +0.16 600 0 255 0 1 64 +0.16 1200 0 127 0 0 129 +0.16 2400 0 63 0 0 64 +0.16 4800 0 31 0 0 32 ?1.36 9600 0 15 0 0 15 +1.73 19200 0 7 0 0 7 +1.73 31250 0 4 ?1.70 0 4 0 38400 0 3 0 0 3 +1.73
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 306 of 526 rej09b0326-0600 notes: 1. the setting should be made so that the error is not more than 1%. 2. the value set in brr is given by the following equation: n = 10 6 ? 1 osc (64 2 2n b) where b: bit rate (bit/s) n: baud rate generator brr setting (0 n 255) osc: value of osc (mhz) n: baud rate generator input clock number (n = 0, 1, 2, or 3) (the relation between n and the clock is shown in table 10.7.) table 10.7 relation between n and clock smr setting n clock cks1 cks0 0 0 0 1 /4 0 1 2 16 1 0 3 /64 1 1 3. the error in table 10.6 is the value obtained from the following equation, rounded to two decimal places. b (rate obtained from n, n, osc) ? r (bit rate in left-hand column in table 10.6) r (bit rate in left-hand column in table 10.6) error (%) = 100
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 307 of 526 rej09b0326-0600 table 10.8 shows the maximum bit rate for each frequency. the values shown are for active (high- speed) mode. table 10.8 maximum bit rate for each frequency (asynchronous mode) setting osc (mhz) maximum bit rate (bits/s) n n 2 31250 0 0 2.4576 38400 0 0 4 62500 0 0 4.194304 65536 0 0 4.9152 76800 0 0 6 93750 0 0 7.3728 115200 0 0 8 125000 0 0 9.8304 153600 0 0 10 156250 0 0
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 308 of 526 rej09b0326-0600 table 10.9 shows examples of brr settings in synchronous mode. the values shown are for active (high-speed) mode. table 10.9 examples of brr settings for various bit rates (synchronous mode) osc (mhz) bit rate 2 4 8 10 (bits/s) n n n n n n n n 110 ? ? ? ? ? ? ? ? 250 1 249 2 124 2 249 ? ? 500 1 124 1 249 2 124 ? ? 1 k 0 249 1 124 1 249 ? ? 2.5 k 0 99 0 199 1 99 1 124 5 k 0 49 0 99 0 199 0 249 10 k 0 24 0 49 0 99 0 124 25 k 0 9 0 19 0 39 0 49 50 k 0 4 0 9 0 19 0 24 100 k ? ? 0 4 0 9 ? ? 250 k 0 0 * 0 1 0 3 0 4 500 k 0 0 * 0 1 ? ? 1 m 0 0 * ? ? 2.5 m legend: blank: cannot be set. ? : a setting can be made, but an error will result. * : continuous transmission/reception is not possible.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 309 of 526 rej09b0326-0600 note: the value set in brr is given by the following equation: n = 10 6 ? 1 osc (8 2 2n b) where b: bit rate (bit/s) n: baud rate generator brr setting (0 n 255) osc: value of osc (mhz) n: baud rate generator input clock number (n = 0, 1, 2, or 3) (the relation between n and the clock is shown in table 10.10.) table 10.10 relation between n and clock smr setting n clock cks1 cks0 0 0 0 1 /4 0 1 2 16 1 0 3 /64 1 1 10.3.3 operation sci3 can perform serial communication in two modes: asynchronous mode in which synchronization is provided character by character, and synchronous mode in which synchronization is provided by clock pulses. the serial mode register (smr) is used to select asynchronous or synchronous mode and the data transfer format, as shown in table 10.11. the clock source for sci3 is determined by bit com in smr and bits cke1 and cke0 in scr3, as shown in table 10.12. asynchronous mode ? choice of 7- or 8-bit data length ? choice of parity addition, multiprocessor bit addition, and addition of 1 or 2 stop bits. (the combination of these parameters determines the data transfer format and the character length.) ? framing error (fer), parity error (per), overrun error (oer), and break detection during reception
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 310 of 526 rej09b0326-0600 ? choice of internal or external clock as the clock source when internal clock is selected: sci3 operates on the baud rate generator clock, and a clock with the same frequency as the bit rate can be output. when external clock is selected: a clock with a frequency 16 times the bit rate must be input. (the on-chip baud rate generator is not used.) synchronous mode ? data transfer format: fixed 8-bit data length ? overrun error (oer) detection during reception ? choice of internal or external clock as the clock source when internal clock is selected: sci3 operates on the baud rate generator clock, and a serial clock is output. when external clock is selected: the on-chip baud rate generator is not used, and sci3 operates on the input serial clock. table 10.11 smr settings and corresponding data transfer formats smr setting communication format bit 7: com bit 6: chr bit 2: mp bit 5: pe bit 3: stop mode data length multipro- cessor bit parity bit stop bit length 0 0 0 0 0 asynchronous 8-bit data no no 1 bit 1 mode 2 bits 1 0 yes 1 bit 1 2 bits 1 0 0 7-bit data no 1 bit 1 2 bits 1 0 yes 1 bit 1 2 bits 0 1 * 0 8-bit data yes no 1 bit * 1 2 bits 1 * 0 7-bit data 1 bit * 1 asynchronous mode (multiprocessor format) 2 bits 1 * 0 * * synchronous mode 8-bit data no no no legend: * don?t care
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 311 of 526 rej09b0326-0600 table 10.12 smr and scr3 settings and clock source selection smr scr3 transmit/receive clock bit 7: com bit 1: cke1 bit 0: cke0 mode clock source sck 3 pin function 0 0 0 asynchronous internal i/o port (sck 3 pin not used) 1 mode outputs clock with same frequency as bit rate 1 0 external inputs clock with frequency 16 times bit rate 1 0 0 synchronous internal outputs serial clock 1 0 mode external inputs serial clock 0 1 1 reserved (do not specify these combinations) 1 0 1 1 1 1 interrupts and continuous transmission/reception: sci3 can carry out continuous reception using rxi and continuous transmission using txi. these interrupts are shown in table 10.13. table 10.13 transmit/receive interrupts interrupt flags interrupt request conditions notes rxi rdrf rie when serial reception is performed normally and receive data is transferred from rsr to rdr, bit rdrf is set to 1, and if bit rie is set to 1 at this time, rxi is enabled and an interrupt is requested. (see figure 10.7 (a).) the rxi interrupt routine reads the receive data transferred to rdr and clears bit rdrf to 0. continuous reception can be performed by repeating the above operations until reception of the next rsr data is completed. txi tdre tie when tsr is found to be empty (on completion of the previous transmission) and the transmit data placed in tdr is transferred to tsr, bit tdre is set to 1. if bit tie is set to 1 at this time, txi is enabled and an interrupt is requested. (see figure 10.7 (b).) the txi interrupt routine writes the next transmit data to tdr and clears bit tdre to 0. continuous transmission can be performed by repeating the above operations until the data transferred to tsr has been transmitted. tei tend teie when the last bit of the character in tsr is transmitted, if bit tdre is set to 1, bit tend is set to 1. if bit teie is set to 1 at this time, tei is enabled and an interrupt is requested. (see figure 10.7 (c).) tei indicates that the next transmit data has not been written to tdr when the last bit of the transmit character in tsr is sent.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 312 of 526 rej09b0326-0600 rdr rsr (reception in progress) rdrf = 0 rxd pin rdr rsr (reception completed, transfer) rdrf 1 (rxi request when rie = 1) rxd pin figure 10.7 (a) rdrf setting and rxi interrupt tdr (next transmit data) tsr (transmission in progress) tdre = 0 txd pin tdr tsr (transmission completed, transfer) tdre 1 (txi request when tie = 1) txd pin figure 10.7 (b) tdre setting and txi interrupt tdr tsr (transmission in progress) tend = 0 txd pin tdr tsr (reception completed) tend 1 (tei request when teie = 1) txd pin figure 10.7 (c) tend setting and tei interrupt
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 313 of 526 rej09b0326-0600 10.3.4 operation in asynchronous mode in asynchronous mode, serial communication is performed with synchronization provided character by character. a start bit indicating the start of communication and one or two stop bits indicating the end of communication are added to each character before it is sent. sci3 has separate transmission and reception units, allowing full-duplex communication. as the transmission and reception units are both double-buffered, data can be written during transmission and read during reception, making possible continuous transmission and reception. data transfer format: the general data transfer format in asynchronous communication is shown in figure 10.8. serial data start bit 1 bit transmit/receive data parity bit stop bit(s) 7 or 8 bits one transfer data unit (character or frame) 1 bit or none 1 or 2 bits mark state 1 (msb) (lsb) figure 10.8 data format in asynchronous communication in asynchronous communication, the communication line is normally in the mark state (high level). sci3 monitors the communication line and when it detects a space (low level), identifies this as a start bit and begins serial data communication. one transfer data character consists of a start bit (low level), followed by transmit/receive data (lsb-first format, starting from the least significant bit), a parity bit (high or low level), and finally one or two stop bits (high level). in asynchronous mode, synchronization is performed by the falling edge of the start bit during reception. the data is sampled on the 8th pulse of a clock with a frequency 16 times the bit period, so that the transfer data is latched at the center of each bit.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 314 of 526 rej09b0326-0600 table 10.14 shows the 12 data transfer formats that can be set in asynchronous mode. the format is selected by the settings in the serial mode register (smr). table 10.14 data transfer formats (asynchronous mode) smr settings serial data transfer format and frame length chr pe mp stop 1 2 3 4 5 6 7 8 9 10 11 12 0 0 0 0 s 8-bit data stop 0 0 0 1 s 8-bit data stop stop 0 1 0 0 s 8-bit data p stop 0 1 0 1 s 8-bit data p stop stop 1 0 0 0 s 7-bit data stop 1 0 0 1 s 7-bit data stop stop 1 1 0 0 s 7-bit data p stop 1 1 0 1 s 7-bit data p stop stop 0 * 1 0 s 8-bit data mpb stop 0 * 1 1 s 8-bit data mpb stop stop 1 * 1 0 s 7-bit data mpb stop 1 * 1 1 s 7-bit data mpb stop stop legend: s: start bit stop: stop bit p: parity bit mpb: multiprocessor bit *: don?t care
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 315 of 526 rej09b0326-0600 clock: either an internal clock generated by the baud rate generator or an external clock input at the sck 3 pin can be selected as the sci3 transmit/receive clock. the selection is made by means of bit com in smr and bits cke1 and cke0 in scr3. see table 10.12 for details on clock source selection. when an external clock is input at the sck 3 pin, a clock with a frequency of 16 times the bit rate used should be input. when sci3 operates on an internal clock, the clock can be output at the sck 3 pin. in this case the frequency of the output clock is the same as the bit rate, and the phase is such that the clock rises at the center of each bit of transmit/receive data, as shown in figure 10.9. 1 character (1 frame) 0 d0d1d2d3d4d5d6d70/1 1 1 clock serial data figure 10.9 phase relationship between output clock and transfer data (asynchronous mode) (8-bit data, parity, 2 stop bits) data transfer operations sci3 initialization: before data is transferred on sci3, bits te and re in scr3 must first be cleared to 0, and then sci3 must be initialized as follows. note: if the operation mode or data transfer format is changed, bits te and re must first be cleared to 0. when bit te is cleared to 0, bit tdre is set to 1. note that the rdrf, per, fer, and oer flags and the contents of rdr are retained when re is cleared to 0. when an external clock is used in asynchronous mode, the clock should not be stopped during operation, including initialization. when an external clock is used in synchronous mode, the clock should not be supplied during operation, including initialization.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 316 of 526 rej09b0326-0600 figure 10.10 shows an example of a flowchart for initializing sci3. start end clear bits te and re to 0 in scr3 1 2 3 set bits cke1 and cke0 set data transfer format in smr set value in brr no wait yes 4 has 1-bit period elapsed? set clock selection in scr3. be sure to clear the other bits to 0. if clock output is selected in asynchronous mode, the clock is output immediately after setting bits cke1 and cke0. if clock output is selected for reception in synchronous mode, the clock is output immediately after bits cke1, cke0, and re are set to 1. set the data transfer format in the serial mode register (smr). write the value corresponding to the transfer rate in brr. this operation is not necessary when an external clock is selected. 1. 2. 3. 4. wait for at least the interval required to transmit or receive one bit, then set te or re in the serial control register (scr3). setting re enables the rxd pin to be used, and when transmitting, setting bit txd in pmr7 enables the txd output pin to be used. also set the rie, tie, teie, and mpie bits as necessary to enable interrupts. the initial states are the mark transmit state and the idle receive state (waiting for a start bit). set bit te or re to 1 in scr3, set bits rie, tie, teie, and mpie as necessary, and when transmitting (te = 1), set bit txd to 1 in pmr7 figure 10.10 example of sci3 initialization flowchart
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 317 of 526 rej09b0326-0600 transmitting: figure 10.11 shows an example of a flowchart for data transmission. this procedure should be followed for data transmission after initializing sci3. start end read bit tdre in ssr 1 2 3 write transmit data to tdr read bit tend in ssr set pdr = 0, pcr = 1 clear bit te to 0 in scr3 no tdre = 1? yes continue data transmission? no tend = 1? no yes yes yes no break output? read the serial status register (ssr) and check that bit tdre is set to 1, then write transmit data to the transmit data register (tdr). when data is written to tdr, bit tdre is cleared to 0 automatically. when continuing data transmission, be sure to read tdre = 1 to confirm that a write can be performed before writing data to tdr. when data is written to tdr, bit tdre is cleared to 0 automatically. if a break is to be output when data transmission ends, set the port pcr to 1 and clear the port pdr to 0, then clear bit txd in pmr7 and bit te in scr3 to 0. 1. 2. 3. figure 10.11 example of data transmission flowchart (asynchronous mode)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 318 of 526 rej09b0326-0600 sci3 operates as follows when transmitting data. sci3 monitors bit tdre in ssr, and when it is cleared to 0, recognizes that data has been written to tdr and transfers data from tdr to tsr. it then sets bit tdre to 1 and starts transmitting. if bit tie in scr3 is set to 1 at this time, a txi request is made. serial data is transmitted from the txd pin using the relevant data transfer format in table 10.14. when the stop bit is sent, sci3 checks bit tdre. if bit tdre is cleared to 0, sci3 transfers data from tdr to tsr, and when the stop bit has been sent, starts transmission of the next frame. if bit tdre is set to 1, bit tend in ssr is set to 1, and the mark state, in which 1s are transmitted, is established after the stop bit has been sent. if bit teie in scr3 is set to 1 at this time, a tei request is made. figure 10.12 shows an example of the operation when transmitting in asynchronous mode. 1 frame start bit start bit transmit data transmit data parity bit stop bit parity bit stop bit mar k state 1 frame 0 1 d0 d1 d7 0/1 1 1 1 0 d0 d1 d7 0/1 serial data tdre tend lsi operation txi request tdre cleared to 0 user processing data written to tdr txi request tei request figure 10.12 example of operation when transmitting in asynchronous mode (8-bit data, parity, 1 stop bit)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 319 of 526 rej09b0326-0600 receiving: figure 10.13 shows an example of a flowchart for data reception. this procedure should be followed for data reception after initializing sci3. start end read bits oer, per, fer in ssr 1 2 3 4 read bit rdrf in ssr read receive data in rdr clear bit re to 0 in scr3 yes oer + per + fer = 1? no rdrf = 1? yes continue data reception? no no yes receive error processing (a) read bits oer, per, and fer in the serial status register (ssr) to determine if there is an error. if a receive error has occurred, execute receive error processing. read ssr and check that bit rdrf is set to 1. if it is, read the receive data in rdr. when the rdr data is read, bit rdrf is cleared to 0 automatically. when continuing data reception, finish reading of bit rdrf and rdr before receiving the stop bit of the current frame. when the data in rdr is read, bit rdrf is cleared to 0 automatically. if a receive error has occurred, read bits oer, per, and fer in ssr to identify the error, and after carrying out the necessary error processing, ensure that bits oer, per, and fer are all cleared to 0. reception cannot be resumed if any of these bits is set to 1. in the case of a framing error, a break can be detected by reading the value of the rxd pin.4. 1. 2. 3. 4. figure 10.13 example of data reception flowchart (asynchronous mode)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 320 of 526 rej09b0326-0600 start receive error processing end of receive error processing 4 clear bits oer, per, fer to 0 in ssr yes oer = 1? yes yes fer = 1? break? yes per = 1? no no no no overrun error processing framing error processing (a) parity error processing if a receive error has occurred, read bits oer, per, and fer in ssr to identify the error, and after carrying out the necessary error processing, ensure that bits oer, per, and fer are all cleared to 0. reception cannot be resumed if any of these bits is set to 1. in the case of a framing error, a break can be detected by reading the value of the rxd pin. 4. figure 10.13 example of data reception flowchart (asynchronous mode) (cont) sci3 operates as follows when receiving data. sci3 monitors the communication line, and when it detects a 0 start bit, performs internal synchronization and begins reception. reception is carried out in accordance with the relevant data transfer format in table 10.14. the received data is first placed in rsr in lsb-to-msb order, and then the parity bit and stop bit(s) are received. sci3 then carries out the following checks. ? parity check sci3 checks that the number of 1 bits in the receive data conforms to the parity (odd or even) set in bit pm in the serial mode register (smr). ? stop bit check sci3 checks that the stop bit is 1. if two stop bits are used, only the first is checked. ? status check sci3 checks that bit rdrf is set to 1, indicating that the receive data can be transferred from rsr to rdr.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 321 of 526 rej09b0326-0600 if no receive error is found in the above checks, bit rdrf is set to 1, and the receive data is stored in rdr. if bit rie is set to 1 in scr3, an rxi interrupt is requested. if the error checks identify a receive error, bit oer, per, or fer is set to 1 depending on the kind of error. bit rdrf retains its state prior to receiving the data. if bit rie is set to 1 in scr3, an eri interrupt is requested. table 10.15 shows the conditions for detecting a receive error, and receive data processing. note: no further receive operations are possible while a receive error flag is set. bits oer, fer, per, and rdrf must therefore be cleared to 0 before resuming reception. table 10.15 receive error detection conditions and receive data processing receive error abbreviation detection conditions received data processing overrun error oer when the next date receive operation is completed while bit rdrf is still set to 1 in ssr receive data is not transferred from rsr to rdr framing error fer when the stop bit is 0 receive data is transferred from rsr to rdr parity error per when the parity (odd or even) set in smr is different from that of the received data receive data is transferred from rsr to rdr figure 10.14 shows an example of the operation when receiving in asynchronous mode. 1 frame start bit start bit receive data receive data parity bit stop bit parity bit stop bit mark state (idle state) 1 frame 0 1 d0 d1 d7 0/1 1 0 1 0 d0 d1 d7 0/1 serial data rdrf fer lsi operation user processing rdrf cleared to 0 rdr data read framing error processing rxi request 0 start bit detected eri request in response to framing error figure 10.14 example of operation when receiving in asynchronous mode (8-bit data, parity, 1 stop bit)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 322 of 526 rej09b0326-0600 10.3.5 operation in synchronous mode in synchronous mode, sci3 transmits and receives data in synchronization with clock pulses. this mode is suitable for high-speed serial communication. sci3 has separate transmission and reception units, allowing full-duplex communication with a shared clock. as the transmission and reception units are both double-buffered, data can be written during transmission and read during reception, making possible continuous transmission and reception. data transfer format: the general data transfer format in synchronous communication is shown in figure 10.15. serial clock serial data note: * high level except in continuous transmission/reception lsb msb * * bit 1 bit 0 bit 2 bit 3 bit 4 8 bits one transfer data unit (character or frame) bit 5 bit 6 bit 7 don't care don't care figure 10.15 data format in synchronous communication in synchronous communication, data on the communication line is output from one falling edge of the serial clock until the next falling edge. data confirmation is guaranteed at the rising edge of the serial clock. one transfer data character begins with the lsb and ends with the msb. after output of the msb, the communication line retains the msb state. when receiving in synchronous mode, sci3 latches receive data at the rising edge of the serial clock. the data transfer format uses a fixed 8-bit data length. parity and multiprocessor bits cannot be added.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 323 of 526 rej09b0326-0600 clock: either an internal clock generated by the baud rate generator or an external clock input at the sck 3 pin can be selected as the sci3 serial clock. the selection is made by means of bit com in smr and bits cke1 and cke0 in scr3. see table 10.12 for details on clock source selection. when sci3 operates on an internal clock, the serial clock is output at the sck 3 pin. eight pulses of the serial clock are output in transmission or reception of one character, and when sci3 is not transmitting or receiving, the clock is fixed at the high level. data transfer operations sci3 initialization: data transfer on sci3 first of all requires that sci3 be initialized as described in 10.3.4, sci3 initialization, and shown in figure 10.10. transmitting: figure 10.16 shows an example of a flowchart for data transmission. this procedure should be followed for data transmission after initializing sci3.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 324 of 526 rej09b0326-0600 start end read bit tdre in ssr 1 2 write transmit data to tdr read bit tend in ssr clear bit te to 0 in scr3 no tdre = 1? yes continue data transmission? no tend = 1? yes yes no read the serial status register (ssr) and check that bit tdre is set to 1, then write transmit data to the transmit data register (tdr). when data is written to tdr, bit tdre is cleared to 0 automatically, the clock is output, and data transmission is started. when continuing data transmission, be sure to read tdre = 1 to confirm that a write can be performed before writing data to tdr. when data is written to tdr, bit tdre is cleared to 0 automatically. 1. 2. figure 10.16 example of data transmission flowchart (synchronous mode) sci3 operates as follows when transmitting data. sci3 monitors bit tdre in ssr, and when it is cleared to 0, recognizes that data has been written to tdr and transfers data from tdr to tsr. it then sets bit tdre to 1 and starts transmitting. if bit tie in scr3 is set to 1 at this time, a txi request is made.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 325 of 526 rej09b0326-0600 when clock output mode is selected, sci3 outputs 8 serial clock pulses. when an external clock is selected, data is output in synchronization with the input clock. serial data is transmitted from the txd pin in order from the lsb (bit 0) to the msb (bit 7). when the msb (bit 7) is sent, checks bit tdre. if bit tdre is cleared to 0, sci3 transfers data from tdr to tsr, and starts transmission of the next frame. if bit tdre is set to 1, sci3 sets bit tend to 1 in ssr, and after sending the msb (bit 7), retains the msb state. if bit teie in scr3 is set to 1 at this time, a tei request is made. after transmission ends, the sck 3 pin is fixed at the high level. note: transmission is not possible if an error flag (oer, fer, or per) that indicates the data reception status is set to 1. check that these error flags (oer, fer, and per) are all cleared to 0 before a transmit operation. figure 10.17 shows an example of the operation when transmitting in synchronous mode. serial clock serial data bit 1 bit 0 bit 7 bit 0 1 frame 1 frame bit 1 bit 6 bit 7 tdre tend lsi operation user processing txi request data written to tdr tdre cleared to 0 txi request tei request figure 10.17 example of operation when transmitting in synchronous mode
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 326 of 526 rej09b0326-0600 receiving: figure 10.18 shows an example of a flowchart for data reception. this procedure should be followed for data reception after initializing sci3. start end read bit oer in ssr 1 2 3 4 read bit rdrf in ssr overrun error processing 4 clear bit oer to 0 in ssr read receive data in rdr clear bit re to 0 in scr3 yes oer = 1? no rdrf = 1? yes continue data reception? no no yes overrun error processing end of overrun error processing start overrun error processing read bit oer in the serial status register (ssr) to determine if there is an error. if an overrun error has occurred, execute overrun error processing. read ssr and check that bit rdrf is set to 1. if it is, read the receive data in rdr. when the rdr data is read, bit rdrf is cleared to 0 automatically. when continuing data reception, finish reading of bit rdrf and rdr before receiving the msb (bit 7) of the current frame. when the data in rdr is read, bit rdrf is cleared to 0 automatically. if an overrun error has occurred, read bit oer in ssr, and after carrying out the necessary error processing, clear bit oer to 0. reception cannot be resumed if bit oer is set to 1. 1. 2. 3. 4. figure 10.18 example of data reception flowchart (synchronous mode)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 327 of 526 rej09b0326-0600 sci3 operates as follows when receiving data. sci3 performs internal synchronization and begins reception in synchronization with the serial clock input or output. the received data is placed in rsr in lsb-to-msb order. after the data has been received, sci3 checks that bit rdrf is set to 0, indicating that the receive data can be transferred from rsr to rdr. if this check shows that there is no overrun error, bit rdrf is set to 1, and the receive data is stored in rdr. if bit rie is set to 1 in scr3, an rxi interrupt is requested. if the check identifies an overrun error, bit oer is set to 1. bit rdrf remains set to 1. if bit rie is set to 1 in scr3, an eri interrupt is requested. see table 10.15 for the conditions for detecting an overrun error, and receive data processing. note: no further receive operations are possible while a receive error flag is set. bits oer, fer, per, and rdrf must therefore be cleared to 0 before resuming reception. figure 10.19 shows an example of the operation when receiving in synchronous mode. serial clock serial data bit 0 bit 7 bit 7 bit 0 1 frame 1 frame bit 1 bit 6 bit 7 rdrf oer lsi operation user processing rxi request rdr data read rdre cleared to 0 rxi request eri request in response to overrun error overrun error processing rdr data has not been read (rdrf = 1) figure 10.19 example of operation when receiving in synchronous mode
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 328 of 526 rej09b0326-0600 simultaneous transmit/receive: figure 10.20 shows an example of a flowchart for a simultaneous transmit/receive operation. this procedure should be followed for simultaneous transmission/reception after initializing sci3. start end read bit tdre in ssr 1 2 3 4 write transmit data to tdr read bit oer in ssr read bit rdrf in ssr clear bits te and re to 0 in scr yes tdre = 1? no oer = 1? no rdrf = 1? yes continue data transmission/reception? no yes no read receive data in rdr yes overrun error processing read the serial status register (ssr) and check that bit tdre is set to 1, then write transmit data to the transmit data register (tdr). when data is written to tdr, bit tdre is cleared to 0 automatically. read ssr and check that bit rdrf is set to 1. if it is, read the receive data in rdr. when the rdr data is read, bit rdrf is cleared to 0 automatically. when continuing data transmission/reception, finish reading of bit rdrf and rdr before receiving the msb (bit 7) of the current frame. before transmitting the msb (bit 7) of the current frame, also read tdre = 1 to confirm that a write can be performed, then write data to tdr. when data is written to tdr, bit tdre is cleared to 0 automatically, and when the data in rdr is read, bit rdrf is cleared to 0 automatically. if an overrun error has occurred, read bit oer in ssr, and after carrying out the necessary error processing, clear bit oer to 0. transmission and reception cannot be resumed if bit oer is set to 1. see figure 10.18 for details on overrun error processing. 1. 2. 3. 4. figure 10.20 example of simultaneous data transmission/reception flowchart (synchronous mode)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 329 of 526 rej09b0326-0600 notes: 1. when switching from transmission to simultaneous transmission/reception, check that sci3 has finished transmitting and that bits tdre and tend are set to 1, clear bit te to 0, and then set bits te and re to 1 simultaneously with a single instruction. 2. when switching from reception to simultaneous transmission/reception, check that sci3 has finished receiving, clear bit re to 0, then check that bit rdrf and the error flags (oer, fer, and per) are cleared to 0, and finally set bits te and re to 1 simultaneously with a single instruction. 10.3.6 multiprocessor communication function the multiprocessor communication function enables data to be exchanged among a number of processors on a shared communication line. serial data communication is performed in asynchronous mode using the multiprocessor format (in which a multiprocessor bit is added to the transfer data). in multiprocessor communication, each receiver is assigned its own id code. the serial communication cycle consists of two cycles, an id transmission cycle in which the receiver is specified, and a data transmission cycle in which the transfer data is sent to the specified receiver. these two cycles are differentiated by means of the multiprocessor bit, 1 indicating an id transmission cycle, and 0, a data transmission cycle. the sender first sends transfer data with a 1 multiprocessor bit added to the id code of the receiver it wants to communicate with, and then sends transfer data with a 0 multiprocessor bit added to the transmit data. when a receiver receives transfer data with the multiprocessor bit set to 1, it compares the id code with its own id code, and if they are the same, receives the transfer data sent next. if the id codes do not match, it skips the transfer data until data with the multiprocessor bit set to 1 is sent again. in this way, a number of processors can exchange data among themselves. figure 10.21 shows an example of communication between processors using the multiprocessor format.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 330 of 526 rej09b0326-0600 sender serial data receiver a (id = 01) (id = 02) receiver b h'01 id transmission cycle (specifying the receiver) data transmission cycle (sending data to the receiver specified buy the id) mpb: multiprocessor bit (mpb = 1) (mpb = 0) h'aa communication line (id = 03) receiver c (id = 04) receiver d figure 10.21 example of inter-processor communication using multiprocessor format (sending data h'aa to receiver a) there is a choice of four data transfer formats. if a multiprocessor format is specified, the parity bit specification is invalid. see table 10.14 for details. for details on the clock used in multiprocessor communication, see section 10.3.4, operation in asynchronous mode. multiprocessor transmitting: figure 10.22 shows an example of a flowchart for multiprocessor data transmission. this procedure should be followed for multiprocessor data transmission after initializing sci3.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 331 of 526 rej09b0326-0600 start end read bit tdre in ssr 1 3 2 set bit mpbt in ssr write transmit data to tdr read bit tend in ssr clear bit te to 0 in scr3 set pdr = 0, pcr = 1 yes tdre = 1? no continue data transmission? no tend = 1? break output? no yes yes no yes read the serial status register (ssr) and check that bit tdre is set to 1, then set bit mpbt in ssr to 0 or 1 and write transmit data to the transmit data register (tdr). when data is written to tdr, bit tdre is cleared to 0 automatically. when continuing data transmission, be sure to read tdre = 1 to confirm that a write can be performed before writing data to tdr. when data is written to tdr, bit tdre is cleared to 0 automatically. if a break is to be output when data transmission ends, set the port pcr to 1 and clear the port pdr to 0, then clear bit te in scr3 to 0. 1. 2. 3. figure 10.22 example of multiprocessor data transmission flowchart
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 332 of 526 rej09b0326-0600 sci3 operates as follows when transmitting data. sci3 monitors bit tdre in ssr, and when it is cleared to 0, recognizes that data has been written to tdr and transfers data from tdr to tsr. it then sets bit tdre to 1 and starts transmitting. if bit tie in scr3 is set to 1 at this time, a txi request is made. serial data is transmitted from the txd pin using the relevant data transfer format in table 10.14. when the stop bit is sent, sci3 checks bit tdre. if bit tdre is cleared to 0, sci3 transfers data from tdr to tsr, and when the stop bit has been sent, starts transmission of the next frame. if bit tdre is set to 1, bit tend in ssr is set to 1, and the mark state, in which 1s are transmitted, is established after the stop bit has been sent. if bit teie in scr3 is set to 1 at this time, a tei request is made. figure 10.23 shows an example of the operation when transmitting using the multiprocessor format. 1 frame start bit start bit transmit data transmit data mpb mpb stop bit stop bit mar k state 1 frame 0 1 d0 d1 d7 0/1 1 1 1 0 d0 d1 d7 0/1 serial data tdre tend lsi operation txi request tdre cleared to 0 user processing data written to tdr txi request tei request figure 10.23 example of operation when transmitting using multiprocessor format (8-bit data, multiprocessor bit, 1 stop bit) multiprocessor receiving: figure 10.24 shows an example of a flowchart for multiprocessor data reception. this procedure should be followed for multiprocessor data reception after initializing sci3.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 333 of 526 rej09b0326-0600 start end read bits oer and fer in ssr 2 set bit mpie to 1 in scr3 1 3 4 5 4 read bit rdrf in ssr read receive data in rdr clear bit re to 0 in scr3 yes oer + fer = 1? no no rdrf = 1? yes continue data reception? no yes read bits oer and fer in ssr no own id? yes read bit rdrf in ssr yes oer + fer = 1? no read receive data in rdr no rdrf = 1? yes receive error processing (a) set bit mpie to 1 in scr3. read bits oer and fer in the serial status register (ssr) to determine if there is an error. if a receive error has occurred, execute receive error processing. read ssr and check that bit rdrf is set to 1. if it is, read the receive data in rdr and compare it with this receiver's own id. if the id is not this receiver's, set bit mpie to 1 again. when the rdr data is read, bit rdrf is cleared to 0 automatically. read ssr and check that bit rdrf is set to 1, then read the data in rdr. if a receive error has occurred, read bits oer and fer in ssr to identify the error, and after carrying out the necessary error processing, ensure that bits oer and fer are both cleared to 0. reception cannot be resumed if either of these bits is set to 1. in the case of a framing error, a break can be detected by reading the value of the rxd pin. 1. 2. 3. 4. 5. figure 10.24 example of multiprocessor data reception flowchart
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 334 of 526 rej09b0326-0600 start receive error processing end of receive error processing clear bits oer and fer to 0 in ssr yes oer = 1? yes yes fer = 1? break? no no no overrun error processing framing error processing (a) figure 10.24 example of multiprocessor data reception flowchart (cont) figure 10.25 shows an example of the operation when receiving using the multiprocessor format.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 335 of 526 rej09b0326-0600 1 frame start bit start bit receive data (id1) receive data (data1) mpb mpb stop bit stop bit mark state (idle state) 1 frame 0 1d0d1d711 11 0d0d1 d7 id1 0 serial data mpie rdrf rdr value rdr value lsi operation rxi request mpie cleared to 0 user processing rdrf cleared to 0 no rxi request rdr retains previous state rdr data read when data is not this receiver's id, mpie is set to 1 again 1 frame start bit start bit receive data (id2) receive data (data2) mpb mpb stop bit stop bit mark state (idle state) 1 frame 0 1d0d1d711 11 0 (a) when data does not match this receiver's id (b) when data matches this receiver's id d0 d1 d7 id2 data2 id1 0 serial data mpie rdrf lsi operation rxi request mpie cleared to 0 user processing rdrf cleared to 0 rxi request rdrf cleared to 0 rdr data read when data is this receiver's id, reception is continued rdr data read mpie set to 1 again figure 10.25 example of operation when receiving using multiprocessor format (8-bit data, multiprocessor bit, 1 stop bit)
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 336 of 526 rej09b0326-0600 10.3.7 interrupts sci3 can generate six kinds of interrupts: transmit end, transmit data empty, receive data full, and three receive error interrupts (overrun error, framing error, and parity error). these interrupts have the same vector address. the various interrupt requests are shown in table 10.16. table 10.16 sci3 interrupt requests interrupt abbreviation interrupt request vector address rxi interrupt request initiated by receive data full flag (rdrf) h'002a txi interrupt request initiated by transmit data empty flag (tdre) tei interrupt request initiated by transmit end flag (tend) eri interrupt request initiated by receive error flag (oer, fer, per) each interrupt request can be enabled or disabled by means of bits tie and rie in scr3. when bit tdre is set to 1 in ssr, a txi interrupt is requested. when bit tend is set to 1 in ssr, a tei interrupt is requested. these two interrupts are generated during transmission. the initial value of bit tdre in ssr is 1. therefore, if the transmit data empty interrupt request (txi) is enabled by setting bit tie to 1 in scr3 before transmit data is transferred to tdr, a txi interrupt will be requested even if the transmit data is not ready. also, the initial value of bit tend in ssr is 1. therefore, if the transmit end interrupt request (tei) is enabled by setting bit teie to 1 in scr3 before transmit data is transferred to tdr, a tei interrupt will be requested even if the transmit data has not been sent. effective use of these interrupt requests can be made by having processing that transfers transmit data to tdr carried out in the interrupt service routine. to prevent the generation of these interrupt requests (txi and tei), on the other hand, the enable bits for these interrupt requests (bits tie and teie) should be set to 1 after transmit data has been transferred to tdr. when bit rdrf is set to 1 in ssr, an rxi interrupt is requested, and if any of bits oer, per, and fer is set to 1, an eri interrupt is requested. these two interrupt requests are generated during reception.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 337 of 526 rej09b0326-0600 for further details, see section 3.3, interrupts. 10.3.8 application notes the following points should be noted when using sci3. 1. relation between writes to tdr and bit tdre bit tdre in the serial status register (ssr) is a status flag that indicates that data for serial transmission has not been prepared in tdr. when data is written to tdr, bit tdre is cleared to 0 automatically. when sci3 transfers data from tdr to tsr, bit tdre is set to 1. data can be written to tdr irrespective of the state of bit tdre, but if new data is written to tdr while bit tdre is cleared to 0, the data previously stored in tdr will be lost of it has not yet been transferred to tsr. accordingly, to ensure that serial transmission is performed dependably, you should first check that bit tdre is set to 1, then write the transmit data to tdr once only (not two or more times). 2. operation when a number of receive errors occur simultaneously if a number of receive errors are detected simultaneously, the status flags in ssr will be set to the states shown in table 10.17. if an overrun error is detected, data transfer from rsr to rdr will not be performed, and the receive data will be lost. table 10.17 ssr status flag states and receive data transfer ssr status flags receive data transfer rdrf * oer fer per (rsr rdr) receive error status 1 1 0 0 overrun error 0 0 1 0 o framing error 0 0 0 1 o parity error 1 1 1 0 overrun error + framing error 1 1 0 1 overrun error + parity error 0 0 1 1 o framing error + parity error 1 1 1 1 overrun error + framing error + parity error legend: o: receive data is transferred from rsr to rdr. : receive data is not transferred from rsr to rdr. note: * bit rdrf retains its state prior to data reception.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 338 of 526 rej09b0326-0600 3. break detection and processing when a framing error is detected, a break can be detected by reading the value of the rxd pin directly. in a break, the input from the rxd pin becomes all 0s, with the result that bit fer is set and bit per may also be set. sci3 continues the receive operation even after receiving a break. note, therefore, that even though bit fer is cleared to 0 it will be set to 1 again. 4. mark state and break detection when bit te is cleared to 0, the txd pin functions as an i/o port whose input/output direction and level are determined by pdr and pcr. this fact can be used to set the txd pin to the mark state, or to detect a break during transmission. to keep the communication line in the mark state (1 state) until bit te is set to 1, set pcr = 1 and pdr = 1. since bit te is cleared to 0 at this time, the txd pin functions as an i/o port and 1 is output. to detect a break during transmission, clear bit te to 0 after setting pcr = 1 and pdr = 0. when bit te is cleared to 0, the transmission unit is initialized regardless of the current transmission state, the txd pin functions as an i/o port, and 0 is output from the txd pin. 5. receive error flags and transmit operation (synchronous mode only) when a receive error flag (oer, per, or fer) is set to 1, transmission cannot be started even if bit tdre is cleared to 0. the receive error flags must be cleared to 0 before starting transmission. note also that receive error flags cannot be cleared to 0 even if bit re is cleared to 0. 6. receive data sampling timing and receive margin in asynchronous mode in asynchronous mode, sci3 operates on a basic clock with a frequency 16 times the transfer rate. when receiving, sci3 performs internal synchronization by sampling the falling edge of the start bit with the basic clock. receive data is latched internally at the 8th rising edge of the basic clock. this is illustrated in figure 10.26.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 339 of 526 rej09b0326-0600 0 7 15 0 7 15 0 internal basic clock receive data (rxd) start bit d0 16 clock pulses 8 clock pulses d1 synchronization sampling timing data sampling timing figure 10.26 receive data sampling timing in asynchronous mode consequently, the receive margin in asynchronous mode can be expressed as shown in equation (1). m = (0.5 ? ) ? ? (l ? 0.5) f 100 ? ? ? ? ? ? 1 2 n d ? 0.5 n . . . . . . . . . . . . . . . equation (1) where m: receive margin (%) n: ratio of bit rate to clock (n = 16) d: clock duty (d = 0.5 to 1.0) l: frame length (l = 9 to 12) f: absolute value of clock frequency deviation substituting 0 for f (absolute value of clock frequency deviation) and 0.5 for d (clock duty) in equation (1), a receive margin of 46.875% is given by equation (2). when d = 0.5 and f = 0, m = {0.5 ? 1/(2 16)} 100 [%] = 46.875% . . . . . . . . . . . . . . . . . . equation (2) however, this is only a computed value, and a margin of 20% to 30% should be allowed when carrying out system design.
section 10 serial communication interface rev. 6.00 sep 12, 2006 page 340 of 526 rej09b0326-0600 7. relation between rdr reads and bit rdrf in a receive operation, sci3 continually checks the rdrf flag. if bit rdrf is cleared to 0 when reception of one frame ends, normal data reception is completed. if bit rdrf is set to 1, this indicates that an overrun error has occurred. when the contents of rdr are read, bit rdrf is cleared to 0 automatically. therefore, if bit rdr is read more than once, the second and subsequent read operations will be performed while bit rdrf is cleared to 0. note that, when an rdr read is performed while bit rdrf is cleared to 0, if the read operation coincides with completion of reception of a frame, the next frame of data may be read. this is illustrated in figure 10.27. communication line rdrf rdr frame 1 frame 2 frame 3 data 1 data 1 rdr read rdr read data 1 is read at point (a) data 2 data 3 data 3 (a) data 2 is read at point (b) (b) figure 10.27 relation between rdr read timing and data in this case, only a single rdr read operation (not two or more) should be performed after first checking that bit rdrf is set to 1. if two or more reads are performed, the data read the first time should be transferred to ram, etc., and the ram contents used. also, ensure that there is sufficient margin in an rdr read operation before reception of the next frame is completed. to be precise in terms of timing, the rdr read should be completed before bit 7 is transferred in synchronous mode, or before the stop bit is transferred in asynchronous mode.
section 11 14-bit pwm rev. 6.00 sep 12, 2006 page 341 of 526 rej09b0326-0600 section 11 14-bit pwm 11.1 overview the h8/3644 group is provided with a 14-bit pwm (pulse width modulator) on-chip, which can be used as a d/a converter by connecting a low-pass filter. 11.1.1 features features of the 14-bit pwm are as follows. ? choice of two conversion periods a conversion period of 32,768/ , with a minimum modulation width of 2/ or a conversion period of 16,384/ , with a minimum modulation width of 1/ can be chosen. ? pulse division method for less ripple 11.1.2 block diagram figure 11.1 shows a block diagram of the 14-bit pwm. internal data bus pwdrl pwdru pwcr pwm waveform generator /2 /4 legend: pwdrl: pwdru: pwcr: pwm data register l pwm data register u pwm control register pwm figure 11.1 block diagram of the 14-bit pwm
section 11 14-bit pwm rev. 6.00 sep 12, 2006 page 342 of 526 rej09b0326-0600 11.1.3 pin configuration table 11.1 shows the output pin assigned to the 14-bit pwm. table 11.1 pin configuration name abbrev. i/o function pwm output pin pwm output pulse-division pwm waveform output 11.1.4 register configuration table 11.2 shows the register configuration of the 14-bit pwm. table 11.2 register configuration name abbrev. r/w initial value address pwm control register pwcr w h'fe h'ffd0 pwm data register u pwdru w h'c0 h'ffd1 pwm data register l pwdrl w h'00 h'ffd2 11.2 register descriptions 11.2.1 pwm control register (pwcr) bit 7 6 5 4 3 2 1 0 ? ? ? ? ? ? ? pwcr0 initial value 1 1 1 1 1 1 1 0 read/write ? ? ? ? ? ? ? w pwcr is an 8-bit write-only register for input clock selection. upon reset, pwcr is initialized to h'fe. bits 7 to 1 ? ? ? ? reserved bits: bits 7 to 1 are reserved; they are always read as 1, and cannot be modified.
section 11 14-bit pwm rev. 6.00 sep 12, 2006 page 343 of 526 rej09b0326-0600 bit 0 ? ? ? ? clock select 0 (pwcr0): bit 0 selects the clock supplied to the 14-bit pwm. this bit is a write-only bit; it is always read as 1. bit 0: pwcr0 description 0 the input clock is /2 (t * = 2/ ). the conversion period is 16,384/ , with a minimum modulation width of 1/ (initial value) 1 the input clock is /4 (t * = 4/ ). the conversion period is 32,768/ , with a minimum modulation width of 2/ . note: * t period of pwm input clock 11.2.2 pwm data registers u and l (pwdru, pwdrl) pwdru bit 7 6 5 4 3 2 1 0 ? ? pwdru5 pwdru4 pwdru3 pwdru2 pwdru1 pwdru0 initial value 1 1 0 0 0 0 0 0 read/write ? ? w w w w w w pwdrl bit 7 6 5 4 3 2 1 0 pwdrl7 pwdrl6 pwdrl5 pwdrl4 pwdrl3 pwdrl2 pwdrl1 pwdrl0 initial value 0 0 0 0 0 0 0 0 read/write w w w w w w w w pwdru and pwdrl form a 14-bit write-only register, with the upper 6 bits assigned to pwdru and the lower 8 bits to pwdrl. the value written to pwdru and pwdrl gives the total high- level width of one pwm waveform cycle. when 14-bit data is written to pwdru and pwdrl, the register contents are latched in the pwm waveform generator, updating the pwm waveform generation data. the 14-bit data should always be written in the following sequence: 1. write the lower 8 bits to pwdrl. 2. write the upper 6 bits to pwdru. pwdru and pwdrl are write-only registers. if they are read, all bits are read as 1.
section 11 14-bit pwm rev. 6.00 sep 12, 2006 page 344 of 526 rej09b0326-0600 upon reset, pwdru and pwdrl are initialized to h'c000. 11.3 operation when using the 14-bit pwm, set the registers in the following sequence. 1. set bit pwm in port mode register 1 (pmr1) to 1 so that pin p1 4 /pwm is designated for pwm output. 2. set bit pwcr0 in the pwm control register (pwcr) to select a conversion period of either 32,768/ (pwcr0 = 1) or 16,384/ (pwcr0 = 0). 3. set the output waveform data in pwm data registers u and l (pwdru/l). be sure to write in the correct sequence, first pwdrl then pwdru. when data is written to pwdru, the data in these registers will be latched in the pwm waveform generator, updating the pwm waveform generation in synchronization with internal signals. one conversion period consists of 64 pulses, as shown in figure 11.2. the total of the high- level pulse widths during this period (t h ) corresponds to the data in pwdru and pwdrl. this relation can be represented as follows. t h = (data value in pwdru and pwdrl + 64) t /2 where t is the pwm input clock period, either 2/ (bit pwcr0 = 0) or 4/ (bit pwcr0 = 1). example: settings in order to obtain a conversion period of 8,192 s: when bit pwcr0 = 0, the conversion period is 16,384/ , so must be 2 mhz. in this case t fn = 128 s, with 1/ (resolution) = 0.5 s. when bit pwcr0 = 1, the conversion period is 32,768/ , so must be 4 mhz. in this case t fn = 128 s, with 2/ (resolution) = 0.5 s. accordingly, for a conversion period of 8,192 s, the system clock frequency ( ) must be 2 mhz or 4 mhz. 1 conversion period t f1 t f2 t f63 t f64 t h1 t h2 t h3 t h63 t h64 t = t + t + t + t = t = t hh1h2h3 h64 ..... t f1 f2 f3 ..... = t f64 figure 11.2 pwm output waveform
section 12 a/d converter rev. 6.00 sep 12, 2006 page 345 of 526 rej09b0326-0600 section 12 a/d converter 12.1 overview the h8/3644 group includes on-chip a resistance-ladder-based successive-approximation analog- to-digital converter, and can convert up to 8 channels of analog input. 12.1.1 features the a/d converter has the following features. ? 8-bit resolution ? eight input channels ? conversion time: approx. 12.4 s per channel (at 5-mhz operation) ? built-in sample-and-hold function ? interrupt requested on completion of a/d conversion ? a/d conversion can be started by external trigger input
section 12 a/d converter rev. 6.00 sep 12, 2006 page 346 of 526 rej09b0326-0600 12.1.2 block diagram figure 12.1 shows a block diagram of the a/d converter. internal data bus amr adsr adrr control logic + ? com- parator an an an an an an an an adtrg av av cc ss multiplexer reference voltage irrad av cc av ss 0 1 2 3 4 5 6 7 legend: amr: adsr: adrr: a/d mode register a/d start register a/d result register figure 12.1 block diagram of the a/d converter
section 12 a/d converter rev. 6.00 sep 12, 2006 page 347 of 526 rej09b0326-0600 12.1.3 pin configuration table 12.1 shows the a/d converter pin configuration. table 12.1 pin configuration name abbrev. i/o function analog power supply av cc input power supply and reference voltage of analog part analog ground av ss input ground and reference voltage of analog part analog input 0 an 0 input analog input channel 0 analog input 1 an 1 input analog input channel 1 analog input 2 an 2 input analog input channel 2 analog input 3 an 3 input analog input channel 3 analog input 4 an 4 input analog input channel 4 analog input 5 an 5 input analog input channel 5 analog input 6 an 6 input analog input channel 6 analog input 7 an 7 input analog input channel 7 external trigger input adtrg input external trigger input for starting a/d conversion 12.1.4 register configuration table 12.2 shows the a/d converter register configuration. table 12.2 register configuration name abbrev. r/w initial value address a/d mode register amr r/w h'30 h'ffc4 a/d start register adsr r/w h'7f h'ffc6 a/d result register adrr r undefined h'ffc5
section 12 a/d converter rev. 6.00 sep 12, 2006 page 348 of 526 rej09b0326-0600 12.2 register descriptions 12.2.1 a/d result register (adrr) bit 7 6 5 4 3 2 1 0 adr7 adr6 adr5 adr4 adr3 adr2 adr1 adr0 initial value undefined undefined undefined undefined undefined undefined undefined undefined read/write r r r r r r r r the a/d result register (adrr) is an 8-bit read-only register for holding the results of analog-to- digital conversion. adrr can be read by the cpu at any time, but the adrr values during a/d conversion are undefined. after a/d conversion is complete, the conversion result is stored in adrr as 8-bit data; this data is held in adrr until the next conversion operation starts. adrr is not cleared on reset. 12.2.2 a/d mode register (amr) bit 7 6 5 4 3 2 1 0 cks trge ? ? ch3 ch2 ch1 ch0 initial value 0 0 1 1 0 0 0 0 read/write r/w r/w ? ? r/w r/w r/w r/w amr is an 8-bit read/write register for specifying the a/d conversion speed, external trigger option, and the analog input pins. upon reset, amr is initialized to h'30.
section 12 a/d converter rev. 6.00 sep 12, 2006 page 349 of 526 rej09b0326-0600 bit 7 ? ? ? ? clock select (cks): bit 7 sets the a/d conversion speed. conversion time bit 7: cks conversion period = 2 mhz = 5 mhz = 8 mhz * 1 0 62/ (initial value) 31 s 12.4 s 7.75 s 1 31/ 15.5 s ? * 2 ? notes: 1. applies only to f-ztat, r of the ztat, and r of the mask rom version. 2. operation is not guaranteed if the conversion time is less than 12.4 s. set bit 7 for a value of at least 12.4 s. bit 6 ? ? ? ? external trigger select (trge): bit 6 enables or disables the start of a/d conversion by external trigger input. bit 6: trge description 0 disables start of a/d conversion by external trigger (initial value) 1 enables start of a/d conversion by rising or falling edge of external trigger at pin adtrg * note: * the external trigger ( adtrg ) edge is selected by bit integ5 of iegr2. see section 3.3.2, interrupt edge select register 2 (iegr2) for details. bits 5 and 4 ? ? ? ? reserved bits: bits 5 and 4 are reserved; they are always read as 1, and cannot be modified.
section 12 a/d converter rev. 6.00 sep 12, 2006 page 350 of 526 rej09b0326-0600 bits 3 to 0 ? ? ? ? channel select (ch3 to ch0): bits 3 to 0 select the analog input channel. the channel selection should be made while bit adsf is cleared to 0. bit 3: ch3 bit 2: ch2 bit 1: ch1 bit 0: ch0 analog input channel 0 0 * * no channel selected (initial value) 1 0 0 an 0 1 an 1 1 0 an 2 1 an 3 1 0 0 0 an 4 1 an 5 1 0 an 6 1 an 7 1 0 0 reserved 1 reserved 1 0 reserved 1 reserved legend: * don?t care 12.2.3 a/d start register (adsr) bit 7 6 5 4 3 2 1 0 adsf ? ? ? ? ? ? ? initial value 0 1 1 1 1 1 1 1 read/write r/w ? ? ? ? ? ? ? the a/d start register (adsr) is an 8-bit read/write register for starting and stopping a/d conversion. a/d conversion is started by writing 1 to the a/d start flag (adsf) or by input of the designated edge of the external trigger signal, which also sets adsf to 1. when conversion is complete, the converted data is set in the a/d result register (adrr), and at the same time adsf is cleared to 0.
section 12 a/d converter rev. 6.00 sep 12, 2006 page 351 of 526 rej09b0326-0600 bit 7 ? ? ? ? a/d start flag (adsf): bit 7 controls and indicates the start and end of a/d conversion. bit 7: adsf description 0 read: indicates the completion of a/d conversion (initial value) write: stops a/d conversion 1 read: indicates a/d conversion in progress write: starts a/d conversion bits 6 to 0 ? ? ? ? reserved bits: bits 6 to 0 are reserved; they are always read as 1, and cannot be modified. 12.3 operation 12.3.1 a/d conversion operation the a/d converter operates by successive approximations, and yields its conversion result as 8-bit data. a/d conversion begins when software sets the a/d start flag (bit adsf) to 1. bit adsf keeps a value of 1 during a/d conversion, and is cleared to 0 automatically when conversion is complete. the completion of conversion also sets bit irrad in interrupt request register 2 (irr2) to 1. an a/d conversion end interrupt is requested if bit ienad in interrupt enable register 2 (ienr2) is set to 1. if the conversion time or input channel needs to be changed in the a/d mode register (amr) during a/d conversion, bit adsf should first be cleared to 0, stopping the conversion operation, in order to avoid malfunction. 12.3.2 start of a/d conversion by external trigger input the a/d converter can be made to start a/d conversion by input of an external trigger signal. external trigger input is enabled at pin adtrg when bit trge in amr is set to 1. then when the input signal edge designated in bit integ5 of interrupt edge select register 2 (iegr2) is detected at pin adtrg , bit adsf in adsr will be set to 1, starting a/d conversion. figure 12.2 shows the timing.
section 12 a/d converter rev. 6.00 sep 12, 2006 page 352 of 526 rej09b0326-0600 adtrg (when bit integ5 = 0) adsf a/d conversion figure 12.2 external trigger input timing 12.4 interrupts when a/d conversion ends (adsf changes from 1 to 0), bit irrad in interrupt request register 2 (irr2) is set to 1. a/d conversion end interrupts can be enabled or disabled by means of bit ienad in interrupt enable register 2 (ienr2). for further details see section 3.3, interrupts. 12.5 typical use an example of how the a/d converter can be used is given below, using channel 1 (pin an1) as the analog input channel. figure 12.3 shows the operation timing. 1. bits ch3 to ch0 of the a/d mode register (amr) are set to 0101, making pin an1 the analog input channel. a/d interrupts are enabled by setting bit ienad to 1, and a/d conversion is started by setting bit adsf to 1. 2. when a/d conversion is complete, bit irrad is set to 1, and the a/d conversion result is stored in the a/d result register (adrr). at the same time adsf is cleared to 0, and the a/d converter goes to the idle state. 3. bit ienad = 1, so an a/d conversion end interrupt is requested. 4. the a/d interrupt handling routine starts. 5. the a/d conversion result is read and processed. 6. the a/d interrupt handling routine ends. if adsf is set to 1 again afterward, a/d conversion starts and steps 2 through 6 take place. figures 12.4 and 12.5 show flow charts of procedures for using the a/d converter.
section 12 a/d converter rev. 6.00 sep 12, 2006 page 353 of 526 rej09b0326-0600 idle a/d conversion (1) idle a/d conversion (2) idle interrupt (irrad) ienad adsf channel 1 (an ) operation state adrr 1 set * set * set * read conversion result read conversion result a/d conversion result (1) a/d conversion result (2) a/d conversion starts note: ( ) indicates instruction execution by software. * conversion result is reset when next conversion starts figure 12.3 typical a/d converter operation timing
section 12 a/d converter rev. 6.00 sep 12, 2006 page 354 of 526 rej09b0326-0600 start set a/d conversion speed and input channel perform a/d conversion? end yes no disable a/d conversion end interrupt start a/d conversion adsf = 0? no yes read adsr read adrr data figure 12.4 flow chart of procedure for using a/d converter (1) (polling by software)
section 12 a/d converter rev. 6.00 sep 12, 2006 page 355 of 526 rej09b0326-0600 start set a/d conversion speed and input channels enable a/d conversion end interrupt start a/d conversion a/d conversion end interrupt? yes no end yes no clear bit irrad to 0 in irr2 read adrr data perform a/d conversion? figure 12.5 flow chart of procedure for using a/d converter (2) (interrupts used) 12.6 application notes ? data in the a/d result register (adrr) should be read only when the a/d start flag (adsf) in the a/d start register (adsr) is cleared to 0. ? changing the digital input signal at an adjacent pin during a/d conversion may adversely affect conversion accuracy.
section 12 a/d converter rev. 6.00 sep 12, 2006 page 356 of 526 rej09b0326-0600
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 357 of 526 rej09b0326-0600 section 13 electrical characteristics 13.1 absolute maximum ratings table 13.1 lists the absolute maximum ratings. table 13.1 absolute maximum ratings * 1 item symbol value unit note power supply voltage v cc ?0.3 to +7.0 v analog power supply voltage av cc ?0.3 to +7.0 v programming hd6473644 v pp ?0.3 to +13.0 v voltage hd64f3644, HD64F3643, hd64f3642a fv pp ?0.3 to +13.0 v 2 input voltage ports other than port b v in ?0.3 to v cc +0.3 v port b ?0.3 to av cc +0.3 v test (hd64f3644, HD64F3643,hd64f3642a) ?0.3 to +13.0 v 2 operating temperature t opr ?20 to +75 c storage temperature t stg ?55 to +125 c notes: 1. permanent damage may occur to the chip if maximum ratings are exceeded. normal operation should be under the conditions specified in electrical characteristics. exceeding these values can result in incorrect operation and reduced reliability. 2. the voltage at the fv pp and test pins should not exceed 13 v, including peak overshoot.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 358 of 526 rej09b0326-0600 13.2 electrical characteristics (ztat?, mask rom version) 13.2.1 power supply voltage and operating range the power supply voltage and operating range are indicated by the shaded region in the figures below. 1. power supply voltage vs. oscillator frequency range 10.0 2.7 4.0 5.5 v (v) cc f (mhz) osc 32.768 2.7 4.0 5.5 v (v) cc fw (khz)   active mode (high speed) sleep mode (high speed)  all operating modes 5.0 2.0 * 1 * 1
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 359 of 526 rej09b0326-0600 2. power supply voltage vs. clock frequency range 625.00 2.7 * 1 4.0 5.5 v (v) cc (khz) 5.0 2.7 4.0 5.5 v (v) cc (mhz) 16.384 2.7 4.0 5.5 v (v) cc (khz) sub   active (high speed) mode sleep (high speed) mode (except cpu)    subactive mode subsleep mode (except cpu) watch mode (except cpu)   active (medium speed) mode sleep (medium speed) mode (except cpu) 8.192 4.096 2.5 0.5 39.0625 7.8125 * 1 * 1
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 360 of 526 rej09b0326-0600 3. analog power supply voltage vs. a/d converter guaranteed accuracy range 2.7 * 2 4.0 4.5 5.5 av (v) cc (mhz)   active (high speed) mode sleep (high speed) mode 5.0 2.5 0.5   active (medium speed) mode sleep (medium speed) mode do not exceed the maximum conversion time value. notes: 1. 2.5 v for the hd6433644, hd6433643, hd6433642, hd6433641 and hd6433640. 2. the voltage for guaranteed a/d conversion operation is 2.5 (v). 5.0 2.5 0.5
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 361 of 526 rej09b0326-0600 13.2.2 dc characteristics (hd6473644) table 13.2 lists the dc characteristics of the hd6473644. table 13.2 dc characteristics v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c unless otherwise indicated. values item symbol applicable pins min typ max unit test condition notes input high voltage v ih 0.8 v cc ? v cc +0.3 v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv 0.9 v cc ? v cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode 0.7 v cc ? v cc +0.3 v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 0.8 v cc ? v cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode pb 0 to pb 7 0.7 v cc ? av cc +0.3 v 0.8 v cc ? av cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode osc 1 v cc ? 0.5 ? v cc +0.3 v v cc ? 0.3 ? v cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode note: connect the test pin to v ss .
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 362 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input low voltage v il ?0.3 ? 0.2 v cc v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv ?0.3 ? 0.1 v cc v cc = 2.7 v to 5.5 v including subactive mode ?0.3 ? 0.3 v cc v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 , pb 0 to pb 7 ?0.3 ? 0.2 v cc v cc = 2.7 v to 5.5 v including subactive mode osc 1 ?0.3 ? 0.5 v ?0.3 ? 0.3 v cc = 2.7 v to 5.5 v including subactive mode output high voltage v oh v cc ? 1.0 ? ? v ?i oh = 1.5 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 v cc ? 0.5 ? ? v cc = 2.7 v to 5.5 v ?i oh = 0.1 ma
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 363 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes output low voltage v ol ? ? 0.6 v i ol = 1.6 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 0.4 v cc = 2.7 v to 5.5 v i ol = 0.4 ma p6 0 to p6 7 ? ? 1.0 v i ol = 10.0 ma ? ? 0.4 i ol = 1.6 ma ? ? 0.4 v cc = 2.7 v to 5.5 v i ol = 0.4 ma input/ output leakage current | i il | osc 1 , p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 1.0 a v in = 0.5 v to (v cc ?0.5 v) pb 0 to pb 7 ? ? 1.0 a v in = 0.5 v to (av cc ?0.5 v) input leakage current | i il | res , irq 0 ? ? 20 a v in = 0.5 v to (v cc ?0.5 v) pull-up mos ?i p p1 0 , p1 4 to p1 7 , p3 0 to p3 2 , 50 ? 300 a v cc = 5 v, v in = 0 v current p5 0 to p5 7 ? 25 ? v cc = 2.7 v, v in = 0 v reference value input capaci- c in all input pins except res ? ? 15.0 pf f = 1 mhz, v in = 0 v, tance res ? ? 60.0 t a = 25c irq 0 ? ? 30.0
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 364 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes active mode current dissipation i ope1 v cc ? 10 15 ma active (high- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 5 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value i ope2 v cc ? 2 3 ma active (medium- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 1 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value sleep mode current dissipation i sleep1 v cc ? 5 7 ma sleep (high- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 2 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value i sleep2 v cc ? 2 3 ma sleep (medium- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 1 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value subactive mode current dissipation i sub v cc ? 10 20 a v cc = 2.7 v 32-khz crystal resonator ( sub = w /2) 1, 2 ? 10 ? v cc = 2.7 v 32-khz crystal resonator ( sub = w /8) 1, 2 reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 365 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes subsleep mode current dissipation i subsp v cc ? 5 10 a v cc = 2.7 v 32-khz crystal resonator ( sub = w /2) 1, 2 watch mode current dissipation i watch v cc ? ? 6 a v cc = 2.7 v 32-khz crystal resonator 1, 2 standby mode current dissipation i stby v cc ? ? 5 a 32-khz crystal resonator not used 1, 2 ram data retaining voltage v ram v cc 2 ? ? v notes: 1. pin states during current measurement are given below. mode res res res res pin internal state other pins oscillator pins active (high-speed) mode v cc operates v cc system clock oscillator: ceramic or crystal active (medium- speed) mode operates ( osc /128) subclock oscillator: pin x 1 = v cc sleep (high-speed) mode v cc only timers operate v cc sleep (medium- speed) mode only timers operate ( osc /128) subactive mode v cc operates v cc system clock oscillator: ceramic or crystal subsleep mode v cc only timers operate, cpu stops v cc subclock oscillator: crystal watch mode v cc only time base operates, cpu stops v cc standby mode v cc cpu and timers both stop v cc system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc 2. excludes current in pull-up mos transistors and output buffers.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 366 of 526 rej09b0326-0600 values item symbol min typ max unit allowable output low current (per pin) output pins except port 6 i ol ? ? 2 ma port 6 ? ? 10 allowable output low current (total) output pins except port 6 i ol ? ? 40 ma port 6 ? ? 80 allowable output high current (per pin) all output pins ?i oh ? ? 2 ma allowable output high current (total) all output pins (?i oh ) ? ? 30 ma
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 367 of 526 rej09b0326-0600 13.2.3 ac characteristics (hd6473644) table 13.3 lists the control signal timing, and tables 13.4 and 13.5 list the serial interface timing of the hd6473644. table 13.3 control signal timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. applicable values reference item symbol pins min typ max unit test condition figure system clock oscillation frequency f osc osc 1 , osc 2 2 ? 10 mhz v cc = 2.7 v to 5.5 v osc clock ( osc ) cycle time t osc osc 1 , osc 2 100 ? 1000 ns v cc = 2.7 v to 5.5 v * 1 figure 13.1 system clock ( ) t cyc 2 ? 128 t osc v cc = 2.7 v to 5.5 v * 1 cycle time ? ? 25.6 s subclock oscillation frequency f w x 1 , x 2 ? 32.768 ? khz v cc = 2.7 v to 5.5 v watch clock ( w ) cycle time t w x 1 , x 2 ? 30.5 ? s v cc = 2.7 v to 5.5 v subclock ( sub ) cycle time t subcyc 2 ? 8 t w v cc = 2.7 v to 5.5 v * 2 instruction cycle time 2 ? ? t cyc t subcyc v cc = 2.7 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 40 ms stabilization time (crystal resonator) ? ? 60 v cc = 2.7 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 20 ms stabilization time (ceramic resonator) ? ? 40 v cc = 2.7 v to 5.5 v oscillation stabilization time t rc x 1 , x 2 ? ? 2 s v cc = 2.7 v to 5.5 v external clock high width t cph osc 1 40 ? ? ns v cc = 2.7 v to 5.5 v figure 13.1 external clock low width t cpl osc 1 40 ? ? ns v cc = 2.7 v to 5.5 v external clock rise time t cpr ? ? 15 ns v cc = 2.7 v to 5.5 v external clock fall time t cpf ? ? 15 ns v cc = 2.7 v to 5.5 v pin res low width t rel res 10 ? ? t cyc v cc = 2.7 v to 5.5 v figure 13.2
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 368 of 526 rej09b0326-0600 applicable values reference item symbol pins min typ max unit test condition figure input pin high width t ih irq 0 to irq 3 , int 0 to int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc figure 13.3 input pin low width t il irq 0 to irq 3 , int 6 , int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 2.7 v to 5.5 v notes: 1. a frequency between 1 mhz to 10 mhz is required when an external clock is input. 2. selected with sa1 and sa0 of system clock control register 2 (syscr2).
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 369 of 526 rej09b0326-0600 table 13.4 serial interface (sci1) timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition reference figure input serial clock cycle time t scyc sck 1 2 ? ? t cyc v cc = 2.7 v to 5.5 v figure 13.4 input serial clock high width t sckh sck 1 0.4 ? ? t scyc v cc = 2.7 v to 5.5 v input serial clock low width t sckl sck 1 0.4 ? ? t scyc v cc = 2.7 v to 5.5 v input serial clock t sckr sck 1 ? ? 60 ns rise time ? ? 80 v cc = 2.7 v to 5.5 v input serial clock t sckf sck 1 ? ? 60 ns fall time ? ? 80 v cc = 2.7 v to 5.5 v serial output data t sod so 1 ? ? 200 ns delay time ? ? 350 v cc = 2.7 v to 5.5 v serial input data t sis si 1 180 ? ? ns setup time 360 ? ? v cc = 2.7 v to 5.5 v serial input data t sih si 1 180 ? ? ns hold time 360 ? ? v cc = 2.7 v to 5.5 v
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 370 of 526 rej09b0326-0600 table 13.5 serial interface (sci3) timing v cc = 2.7 v to 5.5 v, av cc = 2.7 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values reference item symbol min typ max unit test condition figure input clock asynchronous t scyc 4 ? ? t cyc cycle synchronous 6 ? ? figure 13.5 input clock pulse width t sckw 0.4 ? 0.6 t scyc t txd ? ? 1 t cyc v cc = 4.0 v to 5.5 v figure 13.6 transmit data delay time (synchronous) ? ? 1 t rxs 200.0 ? ? ns v cc = 4.0 v to 5.5 v receive data setup time (synchronous) 400.0 ? ? t rxh 200.0 ? ? ns v cc = 4.0 v to 5.5 v receive data hold time (synchronous) 400.0 ? ?
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 371 of 526 rej09b0326-0600 13.2.4 dc characteristics (hd6433644, hd6433643, hd6433642, hd6433641, hd6433640) table 13.6 lists the dc characteristics of the hd6433644, the hd6433643, the hd6433642, the hd6433641 and the hd6433640. table 13.6 dc characteristics v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c unless otherwise indicated. values item symbol applicable pins min typ max unit test condition notes input high voltage v ih 0.8 v cc ? v cc +0.3 v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv 0.9 v cc ? v cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode 0.7 v cc ? v cc +0.3 v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 0.8 v cc ? v cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode pb 0 to pb 7 0.7 v cc ? av cc +0.3 v 0.8 v cc ? av cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode osc 1 v cc ?0.5 ? v cc +0.3 v v cc ?0.3 ? v cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode note: connect the test pin to v ss .
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 372 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input low voltage v il ?0.3 ? 0.2 v cc v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv ?0.3 ? 0.1 v cc v cc = 2.5 v to 5.5 v including subactive mode ?0.3 ? 0.3 v cc v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 , pb 0 to pb 7 ?0.3 ? 0.2 v cc v cc = 2.5 v to 5.5 v including subactive mode osc 1 ?0.3 ? 0.5 v ?0.3 ? 0.3 v cc = 2.5 v to 5.5 v including subactive mode
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 373 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes output high voltage v oh v cc ?1.0 ? ? v ?i oh = 1.5 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 v cc ?0.5 ? ? v cc = 2.5 v to 5.5 v ?i oh = 0.1 ma output low voltage v ol ? ? 0.6 v i ol = 1.6 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 0.4 v cc = 2.5 v to 5.5 v i ol = 0.4 ma p6 0 to p6 7 ? ? 1.0 v i ol = 10.0 ma ? ? 0.4 i ol = 1.6 ma ? ? 0.4 v cc = 2.5 v to 5.5 v i ol = 0.4 ma input/ output leakage current | i il | osc 1 , p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 1.0 a v in = 0.5 v to (v cc ?0.5 v) pb 0 to pb 7 ? ? 1.0 a v in = 0.5 v to (av cc ?0.5 v) input leakage current | i il | res , irq 0 ? ? 1 a v in = 0.5 v to (v cc ?0.5 v) pull-up mos ?i p p1 0 , p1 4 to p1 7 , p3 0 to p3 2 , 50 ? 300 a v cc = 5 v, v in = 0 v current p5 0 to p5 7 ? 25 ? v cc = 2.5 v, v in = 0 v reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 374 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input capaci- c in all input pins except res ? ? 15.0 pf f = 1 mhz, v in = 0 v, tance res ? ? 15.0 t a = 25c irq 0 ? ? 15.0 active mode current dissipation i ope1 v cc ? 10 15 ma active (high- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 5 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value i ope2 v cc ? 2 3 ma active (medium- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 1 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value sleep mode current dissipation i sleep1 v cc ? 5 7 ma sleep (high- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 2 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value i sleep2 v cc ? 2 3 ma sleep (medium- speed) mode v cc = 5 v, f osc = 10 mhz 1, 2 ? 1 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value subactive mode current dissipation i sub v cc ? 10 20 a v cc = 2.5 v 32-khz crystal resonator ( sub = w /2) 1, 2 ? 10 ? v cc = 2.5 v 32-khz crystal resonator ( sub = w /8) 1, 2 reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 375 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes subsleep mode current dissipation i subsp v cc ? 5 10 a v cc = 2.5 v 32-khz crystal resonator ( sub = w /2) 1, 2 watch mode current dissipation i watch v cc ? ? 6 a v cc = 2.5 v 32-khz crystal resonator 1, 2 standby mode current dissipation i stby v cc ? ? 5 a 32-khz crystal resonator not used 1, 2 ram data retaining voltage v ram v cc 2 ? ? v notes: 1. pin states during current measurement are given below. mode res res res res pin internal state other pins oscillator pins active (high-speed) mode v cc operates v cc active (medium- speed) mode operates ( osc /128) sleep (high-speed) mode v cc only timers operate v cc sleep (medium- speed) mode only timers operate ( osc /128) system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc subactive mode v cc operates v cc subsleep mode v cc only timers operate, cpu stops v cc watch mode v cc only time base operates, cpu stops v cc system clock oscillator: ceramic or crystal subclock oscillator: crystal standby mode v cc cpu and timers both stop v cc system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc 2. excludes current in pull-up mos transistors and output buffers.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 376 of 526 rej09b0326-0600 values item symbol min typ max unit allowable output low current (per pin) output pins except port 6 i ol ? ? 2 ma port 6 ? ? 10 allowable output low current (total) output pins except port 6 i ol ? ? 40 ma port 6 ? ? 80 allowable output high current (per pin) all output pins ?i oh ? ? 2 ma allowable output high current (total) all output pins (?i oh ) ? ? 30 ma 13.2.5 ac characteristics (hd6433644, hd6433643, hd6433642, hd6433641, hd6433640) table 13.7 lists the control signal timing, and tables 13.8 and 13.9 list the serial interface timing of the hd6433644, the hd6433643, the hd6433642, the hd6433641 and the hd6433640.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 377 of 526 rej09b0326-0600 table 13.7 control signal timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. applicable values reference item symbol pins min typ max unit test condition figure system clock f osc osc 1 , osc 2 2 ? 10 mhz oscillation frequency 2 ? 5 v cc = 2.5 v to 5.5 v osc clock ( osc ) t osc osc 1 , osc 2 100 ? 1000 ns * 1 cycle time 200 ? 1000 v cc = 2.5 v to 5.5 v figure 13.1 system clock ( ) t cyc 2 ? 128 t osc v cc = 2.5 v to 5.5 v * 1 cycle time ? ? 25.6 s subclock oscillation frequency f w x 1 , x 2 ? 32.768 ? khz v cc = 2.5 v to 5.5 v watch clock ( w ) cycle time t w x 1 , x 2 ? 30.5 ? s v cc = 2.5 v to 5.5 v subclock ( sub ) cycle time t subcyc 2 ? 8 t w v cc = 2.5 v to 5.5 v * 2 instruction cycle time 2 ? ? t cyc t subcyc v cc = 2.5 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 40 ms stabilization time (crystal resonator) ? ? 60 v cc = 2.5 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 20 ms stabilization time (ceramic resonator) ? ? 40 v cc = 2.5 v to 5.5 v oscillation stabilization time t rc x 1 , x 2 ? ? 2 s v cc = 2.5 v to 5.5 v external clock high t cph osc 1 40 ? ? ns figure 13.1 width 80 ? ? v cc = 2.5 v to 5.5 v external clock low t cpl osc 1 40 ? ? ns width 80 ? ? v cc = 2.5 v to 5.5 v external clock rise t cpr ? ? 15 ns time ? ? 20 v cc = 2.5 v to 5.5 v external clock fall t cpf ? ? 15 ns time ? ? 20 v cc = 2.5 v to 5.5 v pin res low width t rel res 10 ? ? t cyc v cc = 2.5 v to 5.5 v figure 13.2
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 378 of 526 rej09b0326-0600 applicable values reference item symbol pins min typ max unit test condition figure input pin high width t ih irq 0 to irq 3 , int 0 to int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 2.5 v to 5.5 v figure 13.3 input pin low width t il irq 0 to irq 3 , int 6 , int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 2.5 v to 5.5 v notes: 1. a frequency between 1 mhz to 10 mhz is required when an external clock is input. 2. selected with sa1 and sa0 of system clock control register 2 (syscr2).
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 379 of 526 rej09b0326-0600 table 13.8 serial interface (sci1) timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition referenc e figure input serial clock cycle time t scyc sck 1 2 ? ? t cyc v cc = 2.5 v to 5.5 v figure 13.4 input serial clock high width t sckh sck 1 0.4 ? ? t scyc v cc = 2.5 v to 5.5 v input serial clock low width t sckl sck 1 0.4 ? ? t scyc v cc = 2.5 v to 5.5 v input serial clock t sckr sck 1 ? ? 60 ns rise time ? ? 80 v cc = 2.5 v to 5.5 v input serial clock t sckf sck 1 ? ? 60 ns fall time ? ? 80 v cc = 2.5 v to 5.5 v serial output data t sod so 1 ? ? 200 ns delay time ? ? 350 v cc = 2.5 v to 5.5 v serial input data t sis si 1 180 ? ? ns setup time 360 ? ? v cc = 2.5 v to 5.5 v serial input data t sih si 1 180 ? ? ns hold time 360 ? ? v cc = 2.5 v to 5.5 v
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 380 of 526 rej09b0326-0600 table 13.9 serial interface (sci3) timing v cc = 2.5 v to 5.5 v, av cc = 2.7 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol min typ max unit test condition reference figure input clock asynchronous t scyc 4 ? ? t cyc figure 13.5 cycle synchronous 6 ? ? input clock pulse width t sckw 0.4 ? 0.6 t scyc transmit data delay time (synchronous) t txd ? ? 1 t cyc v cc = 4.0 v to 5.5 v figure 13.6 ? ? 1 receive data setup time (synchronous) t rxs 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ? receive data hold time (synchronous) t rxh 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ?
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 381 of 526 rej09b0326-0600 13.2.6 a/d converter characteristics table 13.10 shows the a/d converter characteristics of the hd6473644, the hd6433644, the hd6433643, the hd6433642, the hd6433641 and the hd6433640. table 13.10 a/d converter characteristics v cc = 2.7 v to 5.5 v, v ss = av ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition reference figure analog power supply voltage av cc av cc 2.7 ? 5.5 v * 1 analog input voltage av in an 0 to an 7 av ss ?0.3 ? av cc +0.3 v analog power ai ope av cc ? ? 1.5 ma av cc = 5 v supply current ai stop1 av cc ? 150.0 ? a * 2 reference value ai stop2 av cc ? ? 5.0 a * 3 analog input capacitance c ain an 0 to an 7 ? ? 30.0 pf allowable signal source impedance r ain ? ? 5.0 k ? resolution ? ? 8 bit nonlinearity error ? ? 2.0 lsb quantization error ? ? 0.5 lsb absolute accuracy ? ? 2.5 lsb conversion time 12.4 ? 124 s notes: 1. set av cc = v cc when the a/d converter is not used. 2. ai stop1 is the current in active and sleep modes while the a/d converter is idle. 3. ai stop2 is the current at reset and in standby, watch, subactive, and subsleep modes while the a/d converter is idle.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 382 of 526 rej09b0326-0600 13.3 electrical characteristics (ztat and r of the mask rom version) 13.3.1 power supply voltage and operating range the power supply voltage and operating range are indicated by the shaded region in the figures below. 1. power supply voltage vs. oscillator frequency range 16.0 2.7 * 1 4.0 5.5 v (v) cc f (mhz) osc 32.768 2.7 * 1 4.0 5.5 v (v) cc fw (khz)   active mode (high speed) sleep mode (high speed)  all operating modes 10.0 2.0
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 383 of 526 rej09b0326-0600 2. power supply voltage vs. clock frequency range 1000.00 2.7 * 1 4.0 5.5 v (v) cc (khz) 8.0 2.7 * 1 4.0 5.5 v (v) cc (mhz) 16.384 2.7 * 1 4.0 5.5 v (v) cc (khz) sub   active (high speed) mode sleep (high speed) mode (except cpu)    subactive mode subsleep mode (except cpu) watch mode (except cpu)   active (medium speed) mode sleep (medium speed) mode (except cpu) 8.192 4.096 5.0 0.5 39.0625 625.00 7.8125
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 384 of 526 rej09b0326-0600 3. analog power supply voltage vs. a/d converter operating range 2.7 * 2 4.0 5.5 av (v) cc (mhz)   active (high speed) mode sleep (high speed) mode 8.0 5.0 0.5   active (medium speed) mode sleep (medium speed) mode do not exceed the maximum conversion time value. notes: 1. 2.5 v for hd6433644r, hd6433643r, hd6433642r, hd6433641r and hd6433640r. 2. ad conversion is guaranteed with 2.5 v.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 385 of 526 rej09b0326-0600 13.3.2 dc characteristics (hd6473644r) table 13.11 lists the dc characteristics of the hd6473644r. table 13.11 dc characteristics v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c unless otherwise indicated. values item symbol applicable pins min typ max unit test condition notes input high voltage v ih 0.8 v cc ? v cc +0.3 v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv 0.9 v cc ? v cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode 0.7 v cc ? v cc +0.3 v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 0.8 v cc ? v cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode pb 0 to pb 7 0.7 v cc ? av cc +0.3 v 0.8 v cc ? av cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode osc 1 v cc ?0.5 ? v cc +0.3 v v cc ?0.3 ? v cc +0.3 v cc = 2.7 v to 5.5 v including subactive mode note: connect the test pin to v ss .
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 386 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input low voltage v il ?0.3 ? 0.2 v cc v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv ?0.3 ? 0.1 v cc v cc = 2.7 v to 5.5 v including subactive mode ?0.3 ? 0.3 v cc v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 , pb 0 to pb 7 ?0.3 ? 0.2 v cc v cc = 2.7 v to 5.5 v including subactive mode osc 1 ?0.3 ? 0.5 v ?0.3 ? 0.3 v cc = 2.7 v to 5.5 v including subactive mode
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 387 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes output high voltage v oh v cc ?1.0 ? ? v ?i oh = 1.5 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 v cc ?0.5 ? ? v cc = 2.7 v to 5.5 v ?i oh = 0.1 ma output low voltage v ol ? ? 0.6 v i ol = 1.6 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 0.4 v cc = 2.7 v to 5.5 v i ol = 0.4 ma p6 0 to p6 7 ? ? 1.0 v i ol = 10.0 ma ? ? 0.4 i ol = 1.6 ma ? ? 0.4 v cc = 2.7 v to 5.5 v i ol = 0.4 ma input/ output leakage current | i il | osc 1 , p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 1.0 a v in = 0.5 v to (v cc ?0.5 v) pb 0 to pb 7 ? ? 1.0 a v in = 0.5 v to (av cc ?0.5 v) input leakage current | i il | res , irq 0 ? ? 20 a v in = 0.5 v to (v cc ?0.5 v) pull-up mos ?i p p1 0 , p1 4 to p1 7 , p3 0 to p3 2 , 50 ? 300 a v cc = 5 v, v in = 0 v current p5 0 to p5 7 ? 25 ? v cc = 2.7 v, v in = 0 v reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 388 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input capaci- c in all input pins except res ? ? 15.0 pf f = 1 mhz, v in = 0 v, tance res ? ? 60.0 t a = 25c irq 0 ? ? 30.0 active mode current dissipation i ope1 v cc ? 15 20 ma active (high- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 5 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value i ope2 v cc ? 3 5 ma active (medium- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 1 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value sleep mode current dissipation i sleep1 v cc ? 6 10 ma sleep (high- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 2 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value i sleep2 v cc ? 2 4 ma sleep (medium- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 1 ? v cc = 2.7 v, f osc = 10 mhz 1, 2 reference value subactive mode current dissipation i sub v cc ? 10 20 a v cc = 2.7 v 32-khz crystal resonator ( sub = w /2) 1, 2 ? 10 ? v cc = 2.7 v 32-khz crystal resonator ( sub = w /8) 1, 2 reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 389 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes subsleep mode current dissipation i subsp v cc ? 5 10 a v cc = 2.7 v 32-khz crystal resonator ( sub = w /2) 1, 2 watch mode current dissipation i watch v cc ? ? 6 a v cc = 2.7 v 32-khz crystal resonator 1, 2 standby mode current dissipation i stby v cc ? ? 5 a 32-khz crystal resonator not used 1, 2 ram data retaining voltage v ram v cc 2 ? ? v notes: 1. pin states during current measurement are given below. mode res res res res pin internal state other pins oscillator pins active (high-speed) mode v cc operates v cc active (medium- speed) mode operates ( osc /128) sleep (high-speed) mode v cc only timers operate v cc sleep (medium- speed) mode only timers operate ( osc /128) system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc subactive mode v cc operates v cc subsleep mode v cc only timers operate, cpu stops v cc watch mode v cc only time base operates, cpu stops v cc system clock oscillator: ceramic or crystal subclock oscillator: crystal standby mode v cc cpu and timers both stop v cc system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc 2. excludes current in pull-up mos transistors and output buffers.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 390 of 526 rej09b0326-0600 values item symbol min typ max unit allowable output low current (per pin) output pins except port 6 i ol ? ? 2 ma port 6 ? ? 10 allowable output low current (total) output pins except port 6 i ol ? ? 40 ma port 6 ? ? 80 allowable output high current (per pin) all output pins ?i oh ? ? 2 ma allowable output high current (total) all output pins (?i oh ) ? ? 30 ma
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 391 of 526 rej09b0326-0600 13.3.3 ac characteristics (hd6473644r) table 13.12 lists the control signal timing, and tables 13.13 and 13.14 list the serial interface timing of the hd6473644r. table 13.12 control signal timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. applicable values reference item symbol pins min typ max unit test condition figure system clock f osc osc 1 , osc 2 2 ? 16 mhz oscillation frequency 2 ? 10 v cc = 2.7 v to 5.5 v osc clock ( osc ) t osc osc 1 , osc 2 62.5 ? 1000 ns cycle time 100 ? 1000 v cc = 2.7 v to 5.5 v * 1 figure 13.1 system clock ( ) t cyc 2 ? 128 t osc v cc = 2.7 v to 5.5 v * 1 cycle time ? ? 25.6 s subclock oscillation frequency f w x 1 , x 2 ? 32.76 8 ? khz v cc = 2.7 v to 5.5 v watch clock ( w ) cycle time t w x 1 , x 2 ? 30.5 ? s v cc = 2.7 v to 5.5 v subclock ( sub ) cycle time t subcyc 2 ? 8 t w v cc = 2.7 v to 5.5 v * 2 instruction cycle time 2 ? ? t cyc t subcyc v cc = 2.7 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 40 ms stabilization time (crystal resonator) ? ? 60 v cc = 2.7 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 20 ms stabilization time (ceramic resonator) ? ? 40 v cc = 2.7 v to 5.5 v oscillation stabilization time t rc x 1 , x 2 ? ? 2 s v cc = 2.7 v to 5.5 v external clock high t cph osc 1 20 ? ? ns figure 13.1 width 40 ? ? v cc = 2.7 v to 5.5 v external clock low t cpl osc 1 20 ? ? ns width 40 ? ? v cc = 2.7 v to 5.5 v external clock rise time t cpr ? ? 15 ns v cc = 2.7 v to 5.5 v external clock fall time t cpf ? ? 15 ns v cc = 2.7 v to 5.5 v
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 392 of 526 rej09b0326-0600 applicable values reference item symbol pins min typ max unit test condition figure pin res low width t rel res 10 ? ? t cyc v cc = 2.7 v to 5.5 v figure 13.2 input pin high level width t ih irq 0 to irq 3 , int 0 to int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 2.7 v to 5.5 v figure 13.3 input pin low level width t il irq 0 to irq 3 , int 6 , int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 2.7 v to 5.5 v notes: 1. a frequency between 1 mhz to 10 mhz is required when an external clock is input. 2. selected with sa1 and sa0 of system clock control register 2 (syscr2).
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 393 of 526 rej09b0326-0600 table 13.13 serial interface (sci1) timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition reference figure input serial clock cycle time t scyc sck 1 2 ? ? t cyc v cc = 2.7 v to 5.5 v figure 13.4 input serial clock high width t sckh sck 1 0.4 ? ? t scyc v cc = 2.7 v to 5.5 v input serial clock low width t sckl sck 1 0.4 ? ? t scyc v cc = 2.7 v to 5.5 v input serial clock t sckr sck 1 ? ? 60 ns rise time ? ? 80 v cc = 2.7 v to 5.5 v input serial clock t sckf sck 1 ? ? 60 ns fall time ? ? 80 v cc = 2.7 v to 5.5 v serial output data t sod so 1 ? ? 200 ns delay time ? ? 350 v cc = 2.7 v to 5.5 v serial input data t sis si 1 180 ? ? ns setup time 360 ? ? v cc = 2.7 v to 5.5 v serial input data t sih si 1 180 ? ? ns hold time 360 ? ? v cc = 2.7 v to 5.5 v
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 394 of 526 rej09b0326-0600 table 13.14 serial interface (sci3) timing v cc = 2.7 v to 5.5 v, av cc = 2.7 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol min typ max unit test condition reference figure asynchronous t scyc 4 ? ? t cyc input clock cycle synchronous 6 ? ? figure 13.5 input clock pulse width t sckw 0.4 ? 0.6 t scyc transmit data delay time (synchronous) t txd ? ? 1 t cyc v cc = 4.0 v to 5.5 v figure 13.6 ? ? 1 receive data setup time (synchronous) t rxs 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ? receive data hold time (synchronous) t rxh 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ?
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 395 of 526 rej09b0326-0600 13.3.4 dc characteristics (hd6433644r, hd6433643r, hd6433642r, hd6433641r, hd6433640r) table 13.15 lists the dc characteristics of the hd6433644r, the hd6433643r, the hd6433642r, the hd6433641r and the hd6433640r. table 13.15 dc characteristics v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c unless otherwise indicated. values item symbol applicable pins min typ max unit test condition notes input high voltage v ih 0.8 v cc ? v cc +0.3 v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv 0.9 v cc ? v cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode 0.7 v cc ? v cc +0.3 v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 0.8 v cc ? v cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode pb 0 to pb 7 0.7 v cc ? av cc +0.3 v 0.8 v cc ? av cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode osc 1 v cc ?0.5 ? v cc +0.3 v v cc ?0.3 ? v cc +0.3 v cc = 2.5 v to 5.5 v including subactive mode note: connect the test pin to v ss .
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 396 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input low voltage v il ?0.3 ? 0.2 v cc v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv ?0.3 ? 0.1 v cc v cc = 2.5 v to 5.5 v including subactive mode ?0.3 ? 0.3 v cc v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 , pb 0 to pb 7 ?0.3 ? 0.2 v cc v cc = 2.5 v to 5.5 v including subactive mode osc 1 ?0.3 ? 0.5 v ?0.3 ? 0.3 v cc = 2.5 v to 5.5 v including subactive mode
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 397 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes output high voltage v oh v cc ?1.0 ? ? v ?i oh = 1.5 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 v cc ?0.5 ? ? v cc = 2.5 v to 5.5 v ?i oh = 0.1 ma output low voltage v ol ? ? 0.6 v i ol = 1.6 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 0.4 v cc = 2.5 v to 5.5 v i ol = 0.4 ma p6 0 to p6 7 ? ? 1.0 v i ol = 10.0 ma ? ? 0.4 i ol = 1.6 ma ? ? 0.4 v cc = 2.5 v to 5.5 v i ol = 0.4 ma input/ output leakage current | i il | osc 1 , p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 0 to p9 4 ? ? 1.0 a v in = 0.5 v to (v cc ?0.5 v) pb 0 to pb 7 ? ? 1.0 a v in = 0.5 v to (av cc ?0.5 v) input leakage current | i il | res , irq 0 ? ? 1 a v in = 0.5 v to (v cc ?0.5 v) pull-up mos ?i p p1 0 , p1 4 to p1 7 , p3 0 to p3 2 , 50 ? 300 a v cc = 5 v, v in = 0 v current p5 0 to p5 7 ? 25 ? v cc = 2.5 v, v in = 0 v reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 398 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input capaci- c in all input pins except res ? ? 15.0 pf f = 1 mhz, v in = 0 v, tance res ? ? 15.0 t a = 25c irq 0 ? ? 15.0 active mode current dissipation i ope1 v cc ? 15 20 ma active (high- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 5 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value i ope2 v cc ? 3 5 ma active (medium- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 1 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value sleep mode current dissipation i sleep1 v cc ? 6 10 ma sleep (high- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 2 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value i sleep2 v cc ? 2 4 ma sleep (medium- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 1 ? v cc = 2.5 v, f osc = 10 mhz 1, 2 reference value subactive mode current dissipation i sub v cc ? 10 20 a v cc = 2.5 v 32-khz crystal resonator ( sub = w /2) 1, 2 ? 10 ? v cc = 2.5 v 32-khz crystal resonator ( sub = w /8) 1, 2 reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 399 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes subsleep mode current dissipation i subsp v cc ? 5 10 a v cc = 2.5 v 32-khz crystal resonator ( sub = w /2) 1, 2 watch mode current dissipation i watch v cc ? ? 6 a v cc = 2.5 v 32-khz crystal resonator 1, 2 standby mode current dissipation i stby v cc ? ? 5 a 32-khz crystal resonator not used 1, 2 ram data retaining voltage v ram v cc 2 ? ? v notes: 1. pin states during current measurement are given below. mode res res res res pin internal state other pins oscillator pins active (high-speed) mode v cc operates v cc active (medium- speed) mode operates ( osc /128) sleep (high-speed) mode v cc only timers operate v cc sleep (medium- speed) mode only timers operate ( osc /128) system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc subactive mode v cc operates v cc subsleep mode v cc only timers operate, cpu stops v cc watch mode v cc only time base operates, cpu stops v cc system clock oscillator: ceramic or crystal subclock oscillator: crystal standby mode v cc cpu and timers both stop v cc system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc 2. excludes current in pull-up mos transistors and output buffers.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 400 of 526 rej09b0326-0600 values item symbol min typ max unit allowable output low current (per pin) output pins except port 6 i ol ? ? 2 ma port 6 ? ? 10 allowable output low current (total) output pins except port 6 i ol ? ? 40 ma port 6 ? ? 80 allowable output high current (per pin) all output pins ?i oh ? ? 2 ma allowable output high current (total) all output pins (?i oh ) ? ? 30 ma 13.3.5 ac characteristics (hd6433644r, hd6433643r, hd6433642r, hd6433641r, hd6433640r) table 13.16 lists the control signal timing, and tables 13.17 and 13.18 list the serial interface timing of the hd6433644r, the hd6433643r, the hd6433642r, the hd6433641r and the hd6433640r.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 401 of 526 rej09b0326-0600 table 13.16 control signal timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. applicable values reference item symbol pins min typ max unit test condition figure system clock f osc osc 1 , osc 2 2 ? 16 mhz oscillation frequency 2 ? 10 v cc = 2.5 v to 5.5 v osc clock ( osc ) t osc osc 1 , osc 2 62.5 ? 1000 ns * 1 cycle time 100 ? 1000 v cc = 2.5 v to 5.5 v figure 13.1 system clock ( ) t cyc 2 ? 128 t osc v cc = 2.5 v to 5.5 v * 1 cycle time ? ? 25.6 s subclock oscillation frequency f w x 1 , x 2 ? 32.768 ? khz v cc = 2.5 v to 5.5 v watch clock ( w ) cycle time t w x 1 , x 2 ? 30.5 ? s v cc = 2.5 v to 5.5 v subclock ( sub ) cycle time t subcyc 2 ? 8 t w v cc = 2.5 v to 5.5 v * 2 instruction cycle time 2 ? ? t cyc t subcyc v cc = 2.5 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 40 ms stabilization time (crystal resonator) ? ? 60 v cc = 2.5 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 20 ms stabilization time (ceramic resonator) ? ? 40 v cc = 2.5 v to 5.5 v oscillation stabilization time t rc x 1 , x 2 ? ? 2 s v cc = 2.5 v to 5.5 v external clock high t cph osc 1 20 ? ? ns figure 13.1 width 40 ? ? v cc = 2.5 v to 5.5 v external clock low t cpl osc 1 20 ? ? ns width 40 ? ? v cc = 2.5 v to 5.5 v external clock rise time t cpr ? ? 15 ns v cc = 2.5 v to 5.5 v external clock fall time t cpf ? ? 15 ns v cc = 2.5 v to 5.5 v pin res low width t rel res 10 ? ? t cyc v cc = 2.5 v to 5.5 v figure 13.2
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 402 of 526 rej09b0326-0600 applicable values reference item symbol pins min typ max unit test condition figure input pin high width t ih irq 0 to irq 3 , int 0 to int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 2.5 v to 5.5 v figure 13.3 input pin low width t il irq 0 to irq 3 , int 6 , int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 2.5 v to 5.5 v notes: 1. a frequency between 1 mhz to 10 mhz is required when an external clock is input. 2. selected with sa1 and sa0 of system clock control register 2 (syscr2).
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 403 of 526 rej09b0326-0600 table 13.17 serial interface (sci1) timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition reference figure input serial clock cycle time t scyc sck 1 2 ? ? t cyc v cc = 2.5 v to 5.5 v figure 13.4 input serial clock high width t sckh sck 1 0.4 ? ? t scyc v cc = 2.5 v to 5.5 v input serial clock low width t sckl sck 1 0.4 ? ? t scyc v cc = 2.5 v to 5.5 v input serial clock t sckr sck 1 ? ? 60 ns rise time ? ? 80 v cc = 2.5 v to 5.5 v input serial clock t sckf sck 1 ? ? 60 ns fall time ? ? 80 v cc = 2.5 v to 5.5 v serial output data t sod so 1 ? ? 200 ns delay time ? ? 350 v cc = 2.5 v to 5.5 v serial input data t sis si 1 180 ? ? ns setup time 360 ? ? v cc = 2.5 v to 5.5 v serial input data t sih si 1 180 ? ? ns hold time 360 ? ? v cc = 2.5 v to 5.5 v
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 404 of 526 rej09b0326-0600 table 13.18 serial interface (sci3) timing v cc = 2.5 v to 5.5 v, av cc = 2.7 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol min typ max unit test condition reference figure asynchronous t scyc 4 ? ? t cyc input clock cycle synchronous 6 ? ? figure 13.5 input clock pulse width t sckw 0.4 ? 0.6 t scyc transmit data delay time (synchronous) t txd ? ? 1 t cyc v cc = 4.0 v to 5.5 v figure 13.6 ? ? 1 receive data setup time (synchronous) t rxs 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ? receive data hold time (synchronous) t rxh 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ?
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 405 of 526 rej09b0326-0600 13.3.6 a/d converter characteristics table 13.19 shows the a/d converter characteristics of the hd6473644r, the hd6433644r, the hd6433643r, the hd6433642r, the hd6433641r and the hd6433640r. table 13.19 a/d converter characteristics v cc = 2.7 v to 5.5 v, v ss = av ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition reference figure analog power supply voltage av cc av cc 2.7 ? 5.5 v * 1 analog input voltage av in an 0 to an 7 av ss ?0.3 ? av cc +0.3 v analog power ai ope av cc ? ? 1.5 ma av cc = 5 v supply current ai stop1 av cc ? 150.0 ? a * 2 reference value ai stop2 av cc ? ? 5.0 a * 3 analog input capacitance c ain an 0 to an 7 ? ? 30.0 pf a llowable signal source impedance r ain ? ? 5.0 k ? resolution ? ? 8 bit nonlinearity error ? ? 2.0 lsb quantization error ? ? 0.5 lsb absolute accuracy ? ? 2.5 lsb conversion time 7.75 ? 124 s notes: 1. set av cc = v cc when the a/d converter is not used. 2. ai stop1 is the current in active and sleep modes while the a/d converter is idle. 3. ai stop2 is the current at reset and in standby, watch, subactive, and subsleep modes while the a/d converter is idle.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 406 of 526 rej09b0326-0600 13.4 electrical characteristics (f-ztat ? ? ? ? version) 13.4.1 power supply voltage and operating range the power supply voltage and operating range are indicated by the shaded region in the figures below. 1. power supply voltage vs. oscillator frequency range 16.0 3.0 4.0 5.5 v (v) cc f (mhz) osc 32.768 3.0 4.0 5.5 v (v) cc fw (khz)   active mode (high speed) sleep mode (high speed)  all operating modes 10.0 2.0
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 407 of 526 rej09b0326-0600 2. power supply voltage vs. clock frequency range 1000.00 3.0 4.0 5.5 v (v) cc (khz) 8.0 3.0 4.0 5.5 v (v) cc (mhz) 16.384 3.0 4.0 5.5 v (v) cc (khz) sub   active (high speed) mode sleep (high speed) mode (except cpu)    subactive mode subsleep mode (except cpu) watch mode (except cpu)   active (medium speed) mode sleep (medium speed) mode (except cpu) 8.192 4.096 5.0 0.5 39.0625 625.00 7.8125
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 408 of 526 rej09b0326-0600 3. analog power supply voltage vs. a/d converter operating range 3.0 4.0 5.5 av (v) cc (mhz)   active (high speed) mode sleep (high speed) mode 8.0 5.0 0.5   active (medium speed) mode sleep (medium speed) mode do not exceed the maximum conversion time value.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 409 of 526 rej09b0326-0600 13.4.2 dc characteristics (hd64f3644, HD64F3643, hd64f3642a) table 13.20 lists the dc characteristics of the hd64f3644, HD64F3643, and hd64f3642a. table 13.20 dc characteristics v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c unless otherwise indicated. values item symbol applicable pins min typ max unit test condition notes input high voltage v ih 0.8 v cc ? v cc +0.3 v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv 0.9 v cc ? v cc +0.3 v cc = 3.0 v to 5.5 v including subactive mode 0.7 v cc ? v cc +0.3 v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 1 to p9 4 0.8 v cc ? v cc +0.3 v cc = 3.0 v to 5.5 v including subactive mode pb 0 to pb 7 0.7 v cc ? av cc +0.3 v 0.8 v cc ? av cc +0.3 v cc = 3.0 v to 5.5 v including subactive mode osc 1 v cc ?0.5 ? v cc +0.3 v v cc ?0.3 ? v cc +0.3 v cc = 3.0 v to 5.5 v including subactive mode note: except in boot mode, connect the test pin to v ss .
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 410 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input low voltage v il ?0.3 ? 0.2 v cc v res , int 0 to int 7 , irq 0 to irq 3 , adtrg , tmib, tmriv, tmciv, ftci, ftia, ftib, ftic, ftid, sck 1 , sck 3 , trgv ?0.3 ? 0.1 v cc v cc = 3.0 v to 5.5 v including subactive mode ?0.3 ? 0.3 v cc v si 1 , rxd, p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 1 to p9 4 , pb 0 to pb 7 ?0.3 ? 0.2 v cc v cc = 3.0 v to 5.5 v including subactive mode osc 1 ?0.3 ? 0.5 v ?0.3 ? 0.3 v cc = 3.0 v to 5.5 v including subactive mode
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 411 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes output high voltage v oh v cc ?1.0 ? ? v ?i oh = 1.5 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 1 to p9 4 v cc ?0.5 ? ? v cc = 3.0 v to 5.5 v ?i oh = 0.1 ma output low voltage v ol ? ? 0.6 v i ol = 1.6 ma p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 1 to p9 4 ? ? 0.4 v cc = 3.0 v to 5.5 v i ol = 0.4 ma p6 0 to p6 7 ? ? 1.0 v i ol = 10.0 ma ? ? 0.4 i ol = 1.6 ma ? ? 0.4 v cc = 2.7 v to 5.5 v i ol = 0.4 ma input/ output leakage current | i il | osc 1 , res , p1 0 , p1 4 to p1 7 , p2 0 to p2 2 , p3 0 to p3 2 , p5 0 to p5 7 , p6 0 to p6 7 , p7 3 to p7 7 , p8 0 to p8 7 , p9 1 to p9 4 ? ? 1.0 a v in = 0.5 v to (v cc ?0.5 v) pb 0 to pb 7 ? ? 1.0 a v in = 0.5 v to (av cc ?0.5 v) input leakage current | i il | irq 0 , test ? ? 20 a v in = 0.5 v to (v cc ?0.5 v) pull-up mos ?i p p1 0 , p1 4 to p1 7 , p3 0 to p3 2 , 50 ? 300 a v cc = 5 v, v in = 0 v current p5 0 to p5 7 ? 35 ? v cc = 3.0 v, v in = 0 v reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 412 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes input capaci- c in all input pins except test ? ? 15.0 pf f = 1 mhz, v in = 0 v, tance irq 0 , test ? ? 30.0 t a = 25c active mode current dissipation i ope1 v cc ? 15 25 ma active (high- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 8.5 ? v cc = 3.0 v, f osc = 10 mhz 1, 2 reference value i ope2 v cc ? 3 5 ma active (medium- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 2 ? v cc = 3.0 v, f osc = 10 mhz 1, 2 reference value sleep mode current dissipation i sleep1 v cc ? 6 10 ma sleep (high- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 3.5 ? v cc = 3.0 v, f osc = 10 mhz 1, 2 reference value i sleep2 v cc ? 2 4 ma sleep (medium- speed) mode v cc = 5 v, f osc = 16 mhz 1, 2 ? 1 ? v cc = 3.0 v, f osc = 10 mhz 1, 2 reference value subactive mode current dissipation i sub v cc ? 1 2 ma v cc = 3.0 v 32-khz crystal resonator ( sub = w /2) 1, 2 ? 1 ? ma v cc = 3.0 v 32-khz crystal resonator ( sub = w /8) 1, 2 reference value
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 413 of 526 rej09b0326-0600 values item symbol applicable pins min typ max unit test condition notes subsleep mode current dissipation i subsp v cc ? 5 10 a v cc = 3.0 v 32-khz crystal resonator ( sub = w /2) 1, 2 watch mode current dissipation i watch v cc ? ? 8 a v cc = 3.0 v 32-khz crystal resonator 1, 2 standby mode current dissipation i stby v cc ? ? 5 a 32-khz crystal resonator not used 1, 2 ram data retaining voltage v ram v cc 2 ? ? v notes: 1. pin states during current measurement are given below. mode res res res res pin internal state other pins oscillator pins active (high-speed) mode v cc operates v cc active (medium- speed) mode operates ( osc /128) sleep (high-speed) mode v cc only timers operate v cc sleep (medium- speed) mode only timers operate ( osc /128) system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc subactive mode v cc operates v cc subsleep mode v cc only timers operate, cpu stops v cc watch mode v cc only time base operates, cpu stops v cc system clock oscillator: ceramic or crystal subclock oscillator: crystal standby mode v cc cpu and timers both stop v cc system clock oscillator: ceramic or crystal subclock oscillator: pin x 1 = v cc 2. excludes current in pull-up mos transistors and output buffers.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 414 of 526 rej09b0326-0600 values item symbol min typ max unit allowable output low current (per pin) output pins except port 6 i ol ? ? 2 ma port 6 ? ? 10 allowable output low current (total) output pins except port 6 i ol ? ? 40 ma port 6 ? ? 80 allowable output high current (per pin) all output pins ?i oh ? ? 2 ma allowable output high current (total) all output pins (?i oh ) ? ? 30 ma
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 415 of 526 rej09b0326-0600 13.4.3 ac characteristics (hd64f3644, HD64F3643, hd64f3642a) table 13.21 lists the control signal timing, and tables 13.22 and 13.23 list the serial interface timing of the hd64f3644, HD64F3643, hd64f3642a. table 13.21 control signal timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. applicable values reference item symbol pins min typ max unit test condition figure system clock f osc osc 1 , osc 2 2 ? 16 mhz oscillation frequency 2 ? 10 v cc = 3.0 v to 5.5 v osc clock ( osc ) t osc osc 1 , osc 2 62.5 ? 1000 ns cycle time 100 ? 1000 v cc = 3.0 v to 5.5 v * 1 figure 13.1 system clock ( ) t cyc 2 ? 128 t osc v cc = 3.0 v to 5.5 v * 1 cycle time ? ? 25.6 s subclock oscillation frequency f w x 1 , x 2 ? 32.768 ? khz v cc = 3.0 v to 5.5 v watch clock ( w ) cycle time t w x 1 , x 2 ? 30.5 ? s v cc = 3.0 v to 5.5 v subclock ( sub ) cycle time t subcyc 2 ? 8 t w v cc = 3.0 v to 5.5 v * 2 instruction cycle time 2 ? ? t cyc t subcyc v cc = 3.0 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 40 ms stabilization time (crystal resonator) ? ? 60 v cc = 3.0 v to 5.5 v oscillation t rc osc 1 , osc 2 ? ? 20 ms stabilization time (ceramic resonator) ? ? 40 v cc = 3.0 v to 5.5 v oscillation stabilization time t rc x 1 , x 2 ? ? 2 s v cc = 3.0 v to 5.5 v external clock high t cph osc 1 20 ? ? ns figure 13.1 width 40 ? ? v cc = 3.0 v to 5.5 v external clock low t cpl osc 1 20 ? ? ns width 40 ? ? v cc = 3.0 v to 5.5 v external clock rise time t cpr ? ? 15 ns v cc = 3.0 v to 5.5 v external clock fall time t cpf ? ? 15 ns v cc = 3.0 v to 5.5 v
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 416 of 526 rej09b0326-0600 applicable values reference item symbol pins min typ max unit test condition figure pin res low width t rel res 10 ? ? t cyc v cc = 3.0 v to 5.5 v figure 13.2 input pin high level width t ih irq 0 to irq 3 , int 0 to int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 3.0 v to 5.5 v figure 13.3 input pin low level width t il irq 0 to irq 3 , int 6 , int 7 , adtrg , tmib, tmciv, tmriv, ftci, ftia, ftib, ftic, ftid, trgv 2 ? ? t cyc t subcyc v cc = 3.0 v to 5.5 v notes: 1. a frequency between 1 mhz to 10 mhz is required when an external clock is input. 2. selected with sa1 and sa0 of system clock control register 2 (syscr2).
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 417 of 526 rej09b0326-0600 table 13.22 serial interface (sci1) timing v cc = 4.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition reference figure input serial clock cycle time t scyc sck 1 2 ? ? t cyc v cc = 3.0 v to 5.5 v figure 13.4 input serial clock high width t sckh sck 1 0.4 ? ? t scyc v cc = 3.0 v to 5.5 v input serial clock low width t sckl sck 1 0.4 ? ? t scyc v cc = 3.0 v to 5.5 v input serial clock t sckr sck 1 ? ? 60 ns rise time ? ? 80 v cc = 3.0 v to 5.5 v input serial clock t sckf sck 1 ? ? 60 ns fall time ? ? 80 v cc = 3.0 v to 5.5 v serial output data t sod so 1 ? ? 200 ns delay time ? ? 350 v cc = 3.0 v to 5.5 v serial input data t sis si 1 180 ? ? ns setup time 360 ? ? v cc = 3.0 v to 5.5 v serial input data t sih si 1 180 ? ? ns hold time 360 ? ? v cc = 3.0 v to 5.5 v
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 418 of 526 rej09b0326-0600 table 13.23 serial interface (sci3) timing v cc = 3.0 v to 5.5 v, av cc = 3.0 v to 5.5 v, v ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values reference item symbol min typ max unit test condition figure asynchronous t scyc 4 ? ? t cyc input clock cycle synchronous 6 ? ? input clock pulse width t sckw 0.4 ? 0.6 t scyc figure 13.5 transmit data delay time (synchronous) t txd ? ? 1 t cyc v cc = 4.0 v to 5.5 v figure 13.6 ? ? 1 receive data setup time (synchronous) t rxs 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ? receive data hold time (synchronous) t rxh 200.0 ? ? ns v cc = 4.0 v to 5.5 v 400.0 ? ?
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 419 of 526 rej09b0326-0600 13.4.4 a/d converter characteristics table 13.24 shows the a/d converter characteristics of the hd64f3644, HD64F3643, and hd64f3642a. table 13.24 a/d converter characteristics v cc = 3.0 v to 5.5 v, v ss = av ss = 0.0 v, t a = ?20c to +75c, unless otherwise specified. values item symbol applicable pins min typ max unit test condition referenc e figure analog power supply voltage av cc av cc 3.0 ? 5.5 v * 1 analog input voltage av in an 0 to an 7 av ss ?0.3 ? av ss +0.3 v analog power ai ope av cc ? ? 1.5 ma av cc = 5.0 v supply current ai stop1 av cc ? 150.0 ? a * 2 reference value ai stop2 av cc ? ? 5.0 a * 3 analog input capacitance c ain an 0 to an 7 ? ? 30.0 pf allowable signal source impedance r ain ? ? 5.0 k ? resolution ? ? 8 bit nonlinearity error ? ? 2.0 lsb quantization error ? ? 0.5 lsb absolute accuracy ? ? 2.5 lsb conversion time 7.75 ? 124 s notes: 1. set av cc = v cc when the a/d converter is not used. 2. ai stop1 is the current in active and sleep modes while the a/d converter is idle. 3. ai stop2 is the current at reset and in standby, watch, subactive, and subsleep modes while the a/d converter is idle.
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 420 of 526 rej09b0326-0600 13.5 operation timing figures 13.1 to 13.6 show timing diagrams. t osc v ih v il t cph t cpl t cpr osc1 t cpf figure 13.1 system clock input timing res v il t rel figure 13.2 res res res res low width timing v ih v il t il irq 0 to irq 3 , int 0 to int 7 , adtrg , tmib, ftia, ftib, tmciv, ftic, ftid, tmriv, ftci, trgv t ih figure 13.3 input timing
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 421 of 526 rej09b0326-0600 t scyc t sckf t sckl t sckh t sod v v oh ol * * t sis t sih sck so si 1 1 1 t sckr v or v ih oh * v or v il ol * note: * output timing reference levels output high: output low: load conditions are shown in figure 13.7. v = 2.0 v v = 0.8 v oh ol figure 13.4 sci1 input/output timing
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 422 of 526 rej09b0326-0600 t scyc 3 t sckw sck figure 13.5 sck 3 input clock timing 3 t scyc t txd t rxs t rxh v oh v or v ih oh v or v il ol * * * v ol * sck txd (transmit data) rxd (receive data) note: * output timing reference levels output high: output low: load conditions are shown in figure 13.7. v = 2.0 v v = 0.8 v oh ol figure 13.6 sci3 synchronous mode input/output timing
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 423 of 526 rej09b0326-0600 13.6 output load circuit v cc 2.4 k ? 12 k ? 30 pf output pin figure 13.7 output load condition
section 13 electrical characteristics rev. 6.00 sep 12, 2006 page 424 of 526 rej09b0326-0600
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 425 of 526 rej09b0326-0600 appendix a cpu instruction set a.1 instructions operation notation rd8/16 general register (destination) (8 or 16 bits) rs8/16 general register (source) (8 or 16 bits) rn8/16 general register (8 or 16 bits) ccr condition code register n n (negative) flag in ccr z z (zero) flag in ccr v v (overflow) flag in ccr c c (carry) flag in ccr pc program counter sp stack pointer #xx: 3/8/16 immediate data (3, 8, or 16 bits) d: 8/16 displacement (8 or 16 bits) @aa: 8/16 absolute address (8 or 16 bits) + addition ? subtraction multiplication division logical and logical or exclusive logical or move ? logical complement condition code notation symbol modified according to the instruction result * undefined (value not guaranteed) 0 always cleared to 0 ? not affected by the instruction execution result
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 426 of 526 rej09b0326-0600 table a.1 lists the h8/300l cpu instruction set. table a.1 instruction set mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @?rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mov.b #xx:8, rd mov.b rs, rd mov.b @rs, rd mov.b @(d:16, rs), rd mov.b @rs+, rd mov.b @aa:8, rd mov.b @aa:16, rd mov.b rs, @rd mov.b rs, @(d:16, rd) mov.b rs, @?rd mov.b rs, @aa:8 mov.b rs, @aa:16 mov.w #xx:16, rd mov.w rs, rd mov.w @rs, rd mov.w @(d:16, rs), rd mov.w @rs+, rd mov.w @aa:16, rd mov.w rs, @rd mov.w rs, @(d:16, rd) mov.w rs, @?rd mov.w rs, @aa:16 pop rd #xx:8 rd8 rs8 rd8 @rs16 rd8 @(d:16, rs16) rd8 @rs16 rd8 rs16+1 rs16 @aa:8 rd8 @aa:16 rd8 rs8 @rd16 rs8 @(d:16, rd16) rd16?1 rd16 rs8 @rd16 rs8 @aa:8 rs8 @aa:16 #xx:16 rd rs16 rd16 @rs16 rd16 @(d:16, rs16) rd16 @rs16 rd16 rs16+2 rs16 @aa:16 rd16 rs16 @rd16 rs16 @(d:16, rd16) rd16?2 rd16 rs16 @rd16 rs16 @aa:16 @sp rd16 sp+2 sp b b b b b b b b b b b b w w w w w w w w w w w 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2 2 4 6 6 4 6 4 6 6 4 6 4 2 4 6 6 6 4 6 6 6 6 2 2 4 2 2 4 2 4 2 2 4 4 2 2 4 2 4 2 4 2 4 2
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 427 of 526 rej09b0326-0600 mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @ ? rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code ? ? push rs add.b #xx:8, rd add.b rs, rd add.w rs, rd addx.b #xx:8, rd addx.b rs, rd adds.w #1, rd adds.w #2, rd inc.b rd daa.b rd sub.b rs, rd sub.w rs, rd subx.b #xx:8, rd subx.b rs, rd subs.w #1, rd subs.w #2, rd dec.b rd das.b rd neg.b rd cmp.b #xx:8, rd cmp.b rs, rd cmp.w rs, rd mulxu.b rs, rd sp ? 2 sp rs16 @sp rd8+#xx:8 rd8 rd8+rs8 rd8 rd16+rs16 rd16 rd8+#xx:8 +c rd8 rd8+rs8 +c rd8 rd16+1 rd16 rd16+2 rd16 rd8+1 rd8 rd8 decimal adjust rd8 rd8 ? rs8 rd8 rd16 ? rs16 rd16 rd8 ? #xx:8 ? c rd8 rd8 ? rs8 ? c rd8 rd16 ? 1 rd16 rd16 ? 2 rd16 rd8 ? 1 rd8 rd8 decimal adjust rd8 0 ? rd rd rd8 ? #xx:8 rd8 ? rs8 rd16 ? rs16 rd8 rs8 rd16 w b b w b b w w b b b w b b w w b b b b b w b 2 ?? 0 ? 6 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 14 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (1) ? ? ? ? (2) ? ? ? (2) ? ? ? ????? ????? ?? ? ? ? (3) ? ? ? ? ? ? ? (1) ? ? ? ? (2) ? ? ? ? (2) ? ? ? ? ????? ????? ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (1) ? ? ? ? ????? ? ?
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 428 of 526 rej09b0326-0600 mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @ ? rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code ? ? divxu.b rs, rd and.b #xx:8, rd and.b rs, rd or.b #xx:8, rd or.b rs, rd xor.b #xx:8, rd xor.b rs, rd not.b rd shal.b rd shar.b rd shll.b rd shlr.b rd rotxl.b rd rotxr.b rd rotl.b rd rotr.b rd rd16 rs8 rd16 (rdh: remainder, rdl: quotient) rd8 #xx:8 rd8 rd8 rs8 rd8 rd8 #xx:8 rd8 rd8 rs8 rd8 rd8 #xx:8 rd8 rd8 rs8 rd8 rd rd b b b b b b b b b b b b b b b b 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (5) (6) ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? 14 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b 7 b 0 0 c b 7 b 0 0 c c b 7 b 0 b 7 b 0 0c c b 7 b 0 c b 7 b 0 c b 7 b 0 c b 7 b 0
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 429 of 526 rej09b0326-0600 mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @ ? rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code ? bset #xx:3, rd bset #xx:3, @rd bset #xx:3, @aa:8 bset rn, rd bset rn, @rd bset rn, @aa:8 bclr #xx:3, rd bclr #xx:3, @rd bclr #xx:3, @aa:8 bclr rn, rd bclr rn, @rd bclr rn, @aa:8 bnot #xx:3, rd bnot #xx:3, @rd bnot #xx:3, @aa:8 bnot rn, rd bnot rn, @rd bnot rn, @aa:8 btst #xx:3, rd btst #xx:3, @rd btst #xx:3, @aa:8 btst rn, rd btst rn, @rd btst rn, @aa:8 (#xx:3 of rd8) 1 (#xx:3 of @rd16) 1 (#xx:3 of @aa:8) 1 (rn8 of rd8) 1 (rn8 of @rd16) 1 (rn8 of @aa:8) 1 (#xx:3 of rd8) 0 (#xx:3 of @rd16) 0 (#xx:3 of @aa:8) 0 (rn8 of rd8) 0 (rn8 of @rd16) 0 (rn8 of @aa:8) 0 (#xx:3 of rd8) (#xx:3 of rd8) (#xx:3 of @rd16) (#xx:3 of @rd16) (#xx:3 of @aa:8) (#xx:3 of @aa:8) (rn8 of rd8) (rn8 of rd8) (rn8 of @rd16) (rn8 of @rd16) (rn8 of @aa:8) (rn8 of @aa:8) (#xx:3 of rd8) z (#xx:3 of @rd16) z (#xx:3 of @aa:8) z (rn8 of rd8) z (rn8 of @rd16) z (rn8 of @aa:8) z b b b b b b b b b b b b b b b b b b b b b b b b 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2 8 8 2 8 8 2 8 8 2 8 8 2 8 8 2 8 8 2 6 6 2 6 6 ? ? ? ? ?
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 430 of 526 rej09b0326-0600 mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @?rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code ? bld #xx:3, rd bld #xx:3, @rd bld #xx:3, @aa:8 bild #xx:3, rd bild #xx:3, @rd bild #xx:3, @aa:8 bst #xx:3, rd bst #xx:3, @rd bst #xx:3, @aa:8 bist #xx:3, rd bist #xx:3, @rd bist #xx:3, @aa:8 band #xx:3, rd band #xx:3, @rd band #xx:3, @aa:8 biand #xx:3, rd biand #xx:3, @rd biand #xx:3, @aa:8 bor #xx:3, rd bor #xx:3, @rd bor #xx:3, @aa:8 bior #xx:3, rd bior #xx:3, @rd bior #xx:3, @aa:8 bxor #xx:3, rd bxor #xx:3, @rd bxor #xx:3, @aa:8 bixor #xx:3, rd (#xx:3 of rd8) c (#xx:3 of @rd16) c (#xx:3 of @aa:8) c (#xx:3 of rd8) c (#xx:3 of @rd16) c (#xx:3 of @aa:8) c c (#xx:3 of rd8) c (#xx:3 of @rd16) c (#xx:3 of @aa:8) c (#xx:3 of rd8) c (#xx:3 of @rd16) c (#xx:3 of @aa:8) c (#xx:3 of rd8) c c (#xx:3 of @rd16) c c (#xx:3 of @aa:8) c c (#xx:3 of rd8) c c (#xx:3 of @rd16) c c (#xx:3 of @aa:8) c c (#xx:3 of rd8) c c (#xx:3 of @rd16) c c (#xx:3 of @aa:8) c c (#xx:3 of rd8) c c (#xx:3 of @rd16) c c (#xx:3 of @aa:8) c c (#xx:3 of rd8) c c (#xx:3 of @rd16) c c (#xx:3 of @aa:8) c c (#xx:3 of rd8) c b b b b b b b b b b b b b b b b b b b b b b b b b b b b 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2 6 6 2 6 6 2 8 8 2 8 8 2 6 6 2 6 6 2 6 6 2 6 6 2 6 6 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 431 of 526 rej09b0326-0600 mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @ ? rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code ? bixor #xx:3, @rd bixor #xx:3, @aa:8 bra d:8 (bt d:8) brn d:8 (bf d:8) bhi d:8 bls d:8 bcc d:8 (bhs d:8) bcs d:8 (blo d:8) bne d:8 beq d:8 bvc d:8 bvs d:8 bpl d:8 bmi d:8 bge d:8 blt d:8 bgt d:8 ble d:8 jmp @rn jmp @aa:16 jmp @@aa:8 bsr d:8 jsr @rn jsr @aa:16 c (#xx:3 of @rd16) c c (#xx:3 of @aa:8) c pc pc+d:8 pc pc+2 if condition is true then pc pc+d:8 else next; b b ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4 2 2 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6 6 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6 8 6 6 8 c z = 0 c z = 1 c = 0 c = 1 z = 0 z = 1 v = 0 v = 1 n = 0 n = 1 n v = 0 n v = 1 z (n v) = 0 z (n v) = 1 pc rn16 pc aa:16 pc @aa:8 sp ? 2 sp pc @sp pc pc+d:8 sp ? 2 sp pc @sp pc rn16 sp ? 2 sp pc @sp pc aa:16 ?
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 432 of 526 rej09b0326-0600 mnemonic operation addressing mode/ instruction length (bytes) operand size #xx: 8/16 rn @rn @(d:16, rn) @ ? rn/@rn+ @aa: 8/16 @(d:8, pc) @@aa implied no. of states ihnzvc condition code jsr @@aa:8 rts rte sleep ldc #xx:8, ccr ldc rs, ccr stc ccr, rd andc #xx:8, ccr orc #xx:8, ccr xorc #xx:8, ccr nop eepmov sp ? 2 sp pc @sp pc @aa:8 pc @sp sp+2 sp ccr @sp sp+2 sp pc @sp sp+2 sp transit to sleep mode. #xx:8 ccr rs8 ccr ccr rd8 ccr #xx:8 ccr ccr #xx:8 ccr ccr #xx:8 ccr pc pc+2 if r4l 0 repeat @r5 @r6 r5+1 r5 r6+1 r6 r4l ? 1 r4l until r4l=0 else next; ? ? ? ? b b b b b b ? ? 2 ?????? 8 8 10 2 2 2 2 2 2 2 2 4 2 ? ? 2 ? ? ? ? 2 ?????? ? ? 2 ? ? ? ? ? ? 2 ? ? ? ? 2 ?????? ? ? 2 ? ? ? ? ? ? 2 ? ? ? ? ? ? 2 ? ? ? ? 2 ?????? ?????? 4 ?????? notes: (1) set to 1 when there is a carry or borrow from bit 11; otherwise cleared to 0. (2) if the result is zero, the previous value of the flag is retained; otherwise the flag is cleared to 0. (3) set to 1 if decimal adjustment produces a carry; otherwise retains value prior to arithmetic operation. (4) the number of states required for execution is 4n + 9 (n = value of r4l). (5) set to 1 if the divisor is negative; otherwise cleared to 0. (6) set to 1 if the divisor is zero; otherwise cleared to 0.
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 433 of 526 rej09b0326-0600 a.2 operation code map table a.2 is an operation code map. it shows the operation codes contained in the first byte of the instruction code (bits 15 to 8 of the first instruction word). instruction when first bit of byte 2 (bit 7 of first instruction word) is 0. instruction when first bit of byte 2 (bit 7 of first instruction word) is 1.
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 434 of 526 rej09b0326-0600 table a.2 operation code map high low 0123456789abcdef 0 1 2 3 4 5 6 7 8 9 a b c d e f nop bra mulxu bset shll shal sleep brn divxu bnot shlr shar stc bhi bclr rotxl rotl ldc bls btst rotxr rotr orc or bcc rts xorc xor bcs bsr bor bior bxor bixor band biand andc and bne rte ldc beq not neg bld bild bst bist add sub bvc bvs mov inc dec bpl jmp adds subs bmi eepmov mov cmp bge blt addx subx bgt jsr daa das ble mov add addx cmp subx or xor and mov mov * note: bit-manipulation instructions the push and pop instructions are identical in machine language to mov instructions. *
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 435 of 526 rej09b0326-0600 a.3 number of execution states the tables here can be used to calculate the number of states required for instruction execution. table a.3 indicates the number of states required for each cycle (instruction fetch, branch address read, stack operation, byte data access, word data access, internal operation). table a.4 indicates the number of cycles of each type occurring in each instruction. the total number of states required for execution of an instruction can be calculated from these two tables as follows: execution states = i s i + j s j + k s k + l s l + m s m + n s n examples: when instruction is fetched from on-chip rom, and an on-chip ram is accessed. bset #0, @ff00 from table a.4: i = l = 2, j = k = m = n= 0 from table a.3: s i = 2, s l = 2 number of states required for execution = 2 2 + 2 2 = 8 when instruction is fetched from on-chip rom, branch address is read from on-chip rom, and on-chip ram is used for stack area. jsr @@ 30 from table a.4: i = 2, j = k = 1, l = m = n = 0 from table a.3: s i = s j = s k = 2 number of states required for execution = 2 2 + 1 2+ 1 2 = 8
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 436 of 526 rej09b0326-0600 table a.3 number of cycles in each instruction execution status access location (instruction cycle) on-chip memory on-chip peripheral module instruction fetch s i 2 ? branch address read s j stack operation s k byte data access s l 2 or 3 * word data access s m ? internal operation s n 1 note: * depends on which on-chip module is accessed. see section 2.9.1, notes on data access for details.
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 437 of 526 rej09b0326-0600 table a.4 number of cycles in each instruction instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n add add.b #xx:8, rd 1 add.b rs, rd 1 add.w rs, rd 1 adds adds.w #1, rd 1 adds.w #2, rd 1 addx addx.b #xx:8, rd 1 addx.b rs, rd 1 and and.b #xx:8, rd 1 and.b rs, rd 1 andc andc #xx:8, ccr 1 band band #xx:3, rd 1 band #xx:3, @rd 2 1 band #xx:3, @aa:8 2 1 bcc bra d:8 (bt d:8) 2 brn d:8 (bf d:8) 2 bhi d:8 2 bls d:8 2 bcc d:8 (bhs d:8) 2 bcs d:8 (blo d:8) 2 bne d:8 2 beq d:8 2 bvc d:8 2 bvs d:8 2 bpl d:8 2 bmi d:8 2 bge d:8 2 blt d:8 2 bgt d:8 2 ble d:8 2 bclr bclr #xx:3, rd 1 bclr #xx:3, @rd 2 2 bclr #xx:3, @aa:8 2 2 bclr rn, rd 1
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 438 of 526 rej09b0326-0600 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n bclr bclr rn, @rd 2 2 bclr rn, @aa:8 2 2 biand biand #xx:3, rd 1 biand #xx:3, @rd 2 1 biand #xx:3, @aa:8 2 1 bild bild #xx:3, rd 1 bild #xx:3, @rd 2 1 bild #xx:3, @aa:8 2 1 bior bior #xx:3, rd 1 bior #xx:3, @rd 2 1 bior #xx:3, @aa:8 2 1 bist bist #xx:3, rd 1 bist #xx:3, @rd 2 2 bist #xx:3, @aa:8 2 2 bixor bixor #xx:3, rd 1 bixor #xx:3, @rd 2 1 bixor #xx:3, @aa:8 2 1 bld bld #xx:3, rd 1 bld #xx:3, @rd 2 1 bld #xx:3, @aa:8 2 1 bnot bnot #xx:3, rd 1 bnot #xx:3, @rd 2 2 bnot #xx:3, @aa:8 2 2 bnot rn, rd 1 bnot rn, @rd 2 2 bnot rn, @aa:8 2 2 bor bor #xx:3, rd 1 bor #xx:3, @rd 2 1 bor #xx:3, @aa:8 2 1 bset bset #xx:3, rd 1 bset #xx:3, @rd 2 2 bset #xx:3, @aa:8 2 2 bset rn, rd 1 bset rn, @rd 2 2
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 439 of 526 rej09b0326-0600 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n bset bset rn, @aa:8 2 2 bsr bsr d:8 2 1 bst bst #xx:3, rd 1 bst #xx:3, @rd 2 2 bst #xx:3, @aa:8 2 2 btst btst #xx:3, rd 1 btst #xx:3, @rd 2 1 btst #xx:3, @aa:8 2 1 btst rn, rd 1 btst rn, @rd 2 1 btst rn, @aa:8 2 1 bxor bxor #xx:3, rd 1 bxor #xx:3, @rd 2 1 bxor #xx:3, @aa:8 2 1 cmp cmp. b #xx:8, rd 1 cmp. b rs, rd 1 cmp.w rs, rd 1 daa daa.b rd 1 das das.b rd 1 dec dec.b rd 1 divxu divxu.b rs, rd 1 12 eepmov eepmov 2 2n+2 * 1 inc inc.b rd 1 jmp jmp @rn 2 jmp @aa:16 2 2 jmp @@aa:8 2 1 2 jsr jsr @rn 2 1 jsr @aa:16 2 1 2 jsr @@aa:8 2 1 1 ldc ldc #xx:8, ccr 1 ldc rs, ccr 1 mov mov.b #xx:8, rd 1 mov.b rs, rd 1
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 440 of 526 rej09b0326-0600 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n mov mov.b @rs, rd 1 1 mov.b @(d:16, rs), rd 2 1 mov.b @rs+, rd 1 1 2 mov.b @aa:8, rd 1 1 mov.b @aa:16, rd 2 1 mov.b rs, @rd 1 1 mov.b rs, @(d:16, rd) 2 1 mov.b rs, @?rd 1 1 2 mov.b rs, @aa:8 1 1 mov.b rs, @aa:16 2 1 mov.w #xx:16, rd 2 mov.w rs, rd 1 mov.w @rs, rd 1 1 mov.w @(d:16, rs), rd 2 1 mov.w @rs+, rd 1 1 2 mov.w @aa:16, rd 2 1 mov.w rs, @rd 1 1 mov.w rs, @(d:16d) 2 1 mov.w rs, @?rd 1 1 2 mov.w rs, @aa:16 2 1 mulxu mulxu.b rs, rd 1 12 neg neg.b rd 1 nop nop 1 not not.b rd 1 or or.b #xx:8, rd 1 or.b rs, rd 1 orc orc #xx:8, ccr 1 rotl rotl.b rd 1 rotr rotr.b rd 1 rotxl rotxl.b rd 1 rotxr rotxr.b rd 1
appendix a cpu instruction set rev. 6.00 sep 12, 2006 page 441 of 526 rej09b0326-0600 instruction mnemonic instruction fetch i branch addr. read j stack operation k byte data access l word data access m internal operation n rte rte 2 2 2 rts rts 2 1 2 shal shal.b rd 1 shar shar.b rd 1 shll shll.b rd 1 shlr shlr.b rd 1 sleep sleep 1 stc stc ccr, rd 1 sub sub.b rs, rd 1 sub.w rs, rd 1 subs subs.w #1, rd 1 subs.w #2, rd 1 pop pop rd 1 1 2 push push rs 1 1 2 subx subx.b #xx:8, rd 1 subx.b rs, rd 1 xor xor.b #xx:8, rd 1 xor.b rs, rd 1 xorc xorc #xx:8, ccr 1 note: n: initial value in r4l. the source and destination operands are accessed n + 1 times each.
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 442 of 526 rej09b0326-0600 appendix b internal i/o registers b.1 addresses register bit names module address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 name h'f740 h'f741 h'f742 h'f743 h'f744 h'f770 tier iciae icibe icice icide ociae ocibe ovie ? timer x h'f771 tcsrx icfa icfb icfc icfd ocfa ocfb ovf cclra h'f772 frch frch7 frch6 frch5 frch4 frch3 frch2 frch1 frch0 h'f773 frcl frcl7 frcl6 frcl5 frcl4 frcl3 frcl2 frcl1 frcl0 h'f774 ocrah/ ocrbh ocrah7/ ocrbh7 ocrah6/ ocrbh6 ocrah5/ ocrbh5 ocrah4/ ocrbh4 ocrah3/ ocrbh3 ocrah2/ ocrbh2 ocrah1/ ocrbh1 ocrah0/ ocrbh0 h'f775 ocral/ ocrbl ocral7/ ocrbl7 ocral6/ ocrbl6 ocral5/ ocrbl5 ocral4/ ocrbl4 ocral3/ ocrbl3 ocral2/ ocrbl2 ocral1/ ocrbl1 ocral0/ ocrbl0 h'f776 tcrx iedga iedgb iedgc iedgd bufea bufeb cks1 cks0 h'f777 tocr ? ? ? ocrs oea oeb olvla olvlb h'f778 icrah icrah7 icrah6 icrah5 icrah4 icrah3 icrah2 icrah1 icrah0 h'f779 icral icral7 icral6 icral5 icral4 icral3 icral2 icral1 icral0 f'f77a icrbh icrbh7 icrbh6 icrbh5 icrbh4 icrbh3 icrbh2 icrbh1 icrbh0 f'f77b icrbl icrbl7 icrbl6 icrbl5 icrbl4 icrbl3 icrbl2 icrbl1 icrbl0 h'f77c icrch icrch7 icrch6 icrch5 icrch4 icrch3 icrch2 icrch1 icrch0 h'f77d icrcl icrcl7 icrcl6 icrcl5 icrcl4 icrcl3 icrcl2 icrcl1 icrcl0 h'f77e icrdh icrdh7 icrdh6 icrdh5 icrdh4 icrdh3 icrdh2 icrdh1 icrdh0 h'f77f icrdl icrdl7 icrdl6 icrdl5 icrdl4 icrdl3 icrdl2 icrdl1 icrdl0 h'ff80 flmcr v pp ? ? ? ev pv e p flash memory h'ff81 (flash memory h'ff82 ebr1 ? ? ? ? lb3 lb2 lb1 lb0 version only) h'ff83 ebr2 sb7 sb6 sb5 sb4 sb3 sb2 sb1 sb0
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 443 of 526 rej09b0326-0600 register bit names module address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 name h'ffa0 scr1 snc1 snc0 mrkon ltch cks3 cks2 cks1 cks0 sci1 h'ffa1 scsr1 ? sol orer ? ? ? mtrf stf h'ffa2 sdru sdru7 sdru6 sdru5 sdru4 sdru3 sdru2 sdru1 sdru0 h'ffa3 sdrl sdrl7 sdrl6 sdrl5 sdrl4 sdrl3 sdrl2 sdrl1 sdrl0 h'ffa4 h'ffa5 h'ffa6 h'ffa7 h'ffa8 smr com chr pe pm stop mp cks1 cks0 sci3 h'ffa9 brr brr7 brr6 brr5 brr4 brr3 brr2 brr1 brr0 h'ffaa scr3 tie rie te re mpie teie cke1 cke0 h'ffab tdr tdr7 tdr6 tdr5 tdr4 tdr3 tdr2 tdr1 tdr0 h'ffac ssr tdre rdrf oer fer per tend mpbr mpbt h'ffad rdr rdr7 rdr6 rdr5 rdr4 rdr3 rdr2 rdr1 rdr0 h'ffae h'ffaf h'ffb0 tma tma7 tma6 tma5 ? tma3 tma2 tma1 tma0 timer a h'ffb1 tca tca7 tca6 tca5 tca4 tca3 tca2 tca1 tca0 h'ffb2 tmb1 tmb17 ? ? ? ? tmb12 tmb11 tmb10 timer b1 h'ffb3 tcb1/ tlb1 tcb17/ tlb17 tcb16/ tlb16 tcb15/ tlb15 tcb14/ tlb14 tcb13/ tlb13 tcb12/ tlb12 tcb11/ tlb11 tcb10/ tlb10 h'ffb4 h'ffb5 h'ffb6 h'ffb7 h'ffb8 tcrv0 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 timer v h'ffb9 tcsrv cmfb cmfa ovf ? os3 os2 os1 os0 h'ffba tcora tcora7 tcora6 tcora5 tcora4 tcora3 tcora2 tcora1 tcora0 h'ffbb tcorb tcorb7 tcorb6 tcorb5 tcorb4 tcorb3 tcorb2 tcorb1 tcorb0 h'ffbc tcntv tcntv7 tcntv6 tcntv5 tcntv4 tcntv3 tcntv2 tcntv1 tcntv0 h'ffbd tcrv1 ? ? ? tveg1 tveg0 trge ? icks0
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 444 of 526 rej09b0326-0600 register bit names module address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 name h'ffbe tcsrw b6wi tcwe b4wi tcsrwe b2wi wdon b0wi wrst watchdog h'ffbf tcw tcw7 tcw6 tcw5 tcw4 tcw3 tcw2 tcw1 tcw0 timer h'ffc0 h'ffc1 h'ffc2 h'ffc3 h'ffc4 amr cks trge ? ? ch3 ch2 ch1 ch0 a/d h'ffc5 adrr adr7 adr6 adr5 adr4 adr3 adr2 adr1 adr0 converter h'ffc6 adsr adsf ? ? ? ? ? ? ? h'ffc7 h'ffc8 h'ffc9 h'ffca h'ffcb h'ffcc h'ffcd h'ffce h'ffcf h'ffd0 pwcr ? ? ? ? ? ? ? pwcr 0 14-bit h'ffd1 pwdru ? ? pwdru 5 pwdru 4 pwdru 3 pwdru 2 pwdru 1 pwdru 0 pwm h'ffd2 pwdrl pwdrl 7 pwdrl 6 pwdrl 5 pwdrl 4 pwdrl 3 pwdrl 2 pwdrl 1 pwdrl 0 h'ffd3 h'ffd4 pdr1 p1 7 p1 6 p1 5 p1 4 ? ? ? p1 0 i/o ports h'ffd5 pdr2 ? ? ? ? ? p2 2 p2 1 p2 0 h'ffd6 pdr3 ? ? ? ? ? p3 2 p3 1 p3 0 h'ffd7 h'ffd8 pdr5 p5 7 p5 6 p5 5 p5 4 p5 3 p5 2 p5 1 p5 0 h'ffd9 pdr6 p6 7 p6 6 p6 5 p6 4 p6 3 p6 2 p6 1 p6 0 h'ffda pdr7 p7 7 p7 6 p7 5 p7 4 p7 3 ? ? ? h'ffdb pdr8 p8 7 p8 6 p8 5 p8 4 p8 3 p8 2 p8 1 p8 0 h'ffdc pdr9 ? ? ? p9 4 p9 3 p9 2 p9 1 p9 0 h'ffdd pdrb pb 7 pb 6 pb 5 pb 4 pb 3 pb 2 pb 1 pb 0 h'ffde h'ffdf
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 445 of 526 rej09b0326-0600 register bit names module address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 name h'ffe0 i/o ports h'ffe1 h'ffe2 h'ffe3 h'ffe4 pcr1 pcr1 7 pcr1 6 pcr1 5 pcr1 4 ? ? ? pcr1 0 h'ffe5 pcr2 ? ? ? ? ? pcr2 2 pcr2 1 pcr2 0 h'ffe6 pcr3 ? ? ? ? ? pcr3 2 pcr3 1 pcr3 0 h'ffe7 h'ffe8 pcr5 pcr5 7 pcr5 6 pcr5 5 pcr5 4 pcr5 3 pcr5 2 pcr5 1 pcr5 0 h'ffe9 pcr6 pcr6 7 pcr6 6 pcr6 5 pcr6 4 pcr6 3 pcr6 2 pcr6 1 pcr6 0 h'ffea pcr7 pcr7 7 pcr7 6 pcr7 5 pcr7 4 pcr7 3 ? ? ? h'ffeb pcr8 pcr8 7 pcr8 6 pcr8 5 pcr8 4 pcr8 3 pcr8 2 pcr8 1 pcr8 0 h'ffec pcr9 ? ? ? pcr9 4 pcr9 3 pcr9 2 pcr9 1 pcr9 0 h'ffed pucr1 pucr1 7 pucr1 6 pucr1 5 pucr1 4 ? ? ? pucr1 0 h'ffee pucr3 ? ? ? ? ? pucr3 2 pucr3 1 pucr3 0 h'ffef pucr5 pucr5 7 pucr5 6 pucr5 5 pucr5 4 pucr5 3 pucr5 2 pucr5 1 pucr5 0 h'fff0 syscr1 ssby sts2 sts1 sts0 lson ? ma1 ma0 system h'fff1 syscr2 ? ? ? nesel dton mson sa1 sa0 control h'fff2 iegr1 ? ? ? ? ieg3 ieg2 ieg1 ieg0 h'fff3 iegr2 integ 7 integ 6 integ 5 integ 4 integ 3 integ 2 integ 1 integ 0 h'fff4 ienr1 ientb1 ienta ? ? ien3 ien2 ien1 ien0 h'fff5 ienr2 iendt ienad ? iens1 ? ? ? ? h'fff6 ienr3 inten7 inten6 inten5 inten4 inten3 inten2 inten1 inten0 h'fff7 irr1 irrtb1 irrta ? ? irri3 irri2 irri1 irri0 h'fff8 irr2 irrdt irrad ? irrs1 ? ? ? ? h'fff9 irr3 intf 7 intf 6 intf 5 intf 4 intf 3 intf 2 intf 1 intf 0 h'fffa h'fffb h'fffc pmr1 irq3 irq2 irq1 pwm ? ? ? tmow i/o ports h'fffd pmr3 ? ? ? ? ? so1 si1 sck1 h'fffe h'ffff pmr7 ? ? ? ? ? txd ? pof1 i/o ports legend: sci1: serial communication interface 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 446 of 526 rej09b0326-0600 b.2 functions tmc?timer mode register c h'b4 timer c register name address to which the register is mapped name of on-chip supporting module register acronym bit numbers initial bit values names of the bits. dashes (?) indicate reserved bits. full name of bit descriptions of bit settings read only write only read and write r w r/w possible types of access bit initial value read/write 7 tmc7 0 r/w 6 tmc6 0 r/w 5 tmc5 0 r/w 3 ? 1 ? 0 tmc0 0 r/w 2 tmc2 0 r/w 1 tmc1 0 r/w 4 ? 1 ? clock select 0 internal clock: internal clock: 0 0 1 internal clock: internal clock: 10 1 1 00 1 10 1 internal clock: internal clock: internal clock: external event (tmic): /8192 /2048 /512 /64 /16 /4 /4 rising or falling edge w counter up/down control tcc is an up-counter tcc is a down-counter 0 0 1 tcc up/down control is determined by input at pin ud. tcc is a down-counter if the ud input is high, and an up-counter if the ud input is low. 1 * auto-reload function select interval timer function selected * don't care auto-reload function selected 0 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 447 of 526 rej09b0326-0600 tier?timer interrupt enable register h'f770 timer x bit initial value read/write 7 iciae 0 r/w 6 icibe 0 r/w 5 icice 0 r/w 4 icide 0 r/w 3 ociae 0 r/w 0 ? 1 ? 2 ocibe 0 r/w 1 ovie 0 r/w timer overflow interrupt enable 0 interrupt request (fovi) by ovf is disabled interrupt request (fovi) by ovf is enabled 1 output compare interrupt b enable 0 interrupt request (ocib) by ocfb is disabled interrupt request (ocib) by ocfb is enabled 1 output compare interrupt a enable 0 interrupt request (ocia) by ocfa is disabled interrupt request (ocia) by ocfa is enabled 1 input capture interrupt d enable 0 interrupt request (icid) by icfd is disabled interrupt request (icid) by icfd is enabled 1 input capture interrupt c enable 0 interrupt request (icic) by icfc is disabled interrupt request (icic) by icfc is enabled 1 input capture interrupt b enable 0 interrupt request (icib) by icfb is disabled interrupt request (icib) by icfb is enabled 1 input capture interrupt a enable 0 interrupt request (icia) by icfa is disabled interrupt request (icia) by icfa is enabled 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 448 of 526 rej09b0326-0600 tcsrx?timer control/status register x h'f771 timer x bit initial value read/write 7 icfa 0 r/(w) 6 icfb 0 r/(w) 5 icfc 0 r/(w) 4 icfd 0 r/(w) 3 ocfa 0 r/(w) 0 cclra 0 r/w 2 ocfb 0 r/(w) 1 ovf 0 r/(w) ******* 0 [clearing condition] after reading ovf = 1, cleared by writing 0 to ovf timer overflow 1 [setting condition] set when the frc value goes from h'ffff to h'0000 0 frc is not cleared by compare match a counter clear a 1 frc is cleared by compare match a 0 [clearing condition] after reading ocfb = 1, cleared by writing 0 to ocfb output compare flag b 1 [setting condition] set when frc matches ocrb 0 [clearing condition] after reading ocfa = 1, cleared by writing 0 to ocfa output compare flag a 1 [setting condition] set when frc matches ocra 0 [clearing condition] after reading icfd = 1, cleared by writing 0 to icfd input capture flag d 1 [setting condition] set by input capture signal 0 [clearing condition] after reading icfc = 1, cleared by writing 0 to icfc input capture flag c 1 [setting condition] set by input capture signal 0 [clearing condition] after reading icfb = 1, cleared by writing 0 to icfb input capture flag b 1 [setting condition] when the value of frc is transferred to icrb by the input capture signal 0 [clearing condition] after reading icfa = 1, cleared by writing 0 to icfa input capture flag a 1 [setting condition] when the value of frc is transferred to icra by the input capture signal note: * only a write of 0 for flag clearing is possible.
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 449 of 526 rej09b0326-0600 frch?free-running counter h h'f772 timer x bit initial value read/write 7 frch7 0 r/w 6 frch6 0 r/w 5 frch5 0 r/w 4 frch4 0 r/w 3 frch3 0 r/w 0 frch0 0 r/w 2 frch2 0 r/w 1 frch1 0 r/w count value frcl?free-running counter l h'f773 timer x bit initial value read/write 7 frcl7 0 r/w 6 frcl6 0 r/w 5 frcl5 0 r/w 4 frcl4 0 r/w 3 frcl3 0 r/w 0 frcl0 0 r/w 2 frcl2 0 r/w 1 frcl1 0 r/w count value ocrah?output compare register ah h'f774 timer x bit initial value read/write 7 ocrah7 1 r/w 6 ocrah6 1 r/w 5 ocrah5 1 r/w 4 ocrah4 1 r/w 3 ocrah3 1 r/w 0 ocrah0 1 r/w 2 ocrah2 1 r/w 1 ocrah1 1 r/w ocrbh?output compare register bh h'f774 timer x bit initial value read/write 7 ocrbh7 1 r/w 6 ocrbh6 1 r/w 5 ocrbh5 1 r/w 4 ocrbh4 1 r/w 3 ocrbh3 1 r/w 0 ocrbh0 1 r/w 2 ocrbh2 1 r/w 1 ocrbh1 1 r/w
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 450 of 526 rej09b0326-0600 ocral?output compare register al h'f775 timer x bit initial value read/write 7 ocral7 1 r/w 6 ocral6 1 r/w 5 ocral5 1 r/w 4 ocral4 1 r/w 3 ocral3 1 r/w 0 ocral0 1 r/w 2 ocral2 1 r/w 1 ocral1 1 r/w ocrbl?output compare register bl h'f775 timer x bit initial value read/write 7 ocrbl7 1 r/w 6 ocrbl6 1 r/w 5 ocrbl5 1 r/w 4 ocrbl4 1 r/w 3 ocrbl3 1 r/w 0 ocrbl0 1 r/w 2 ocrbl2 1 r/w 1 ocrbl1 1 r/w
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 451 of 526 rej09b0326-0600 tcrx?timer control register x h'f776 timer x bit initial value read/write 7 iedga 0 r/w 6 iedgb 0 r/w 5 iedgc 0 r/w 4 iedgd 0 r/w 3 bufea 0 r/w 0 cks0 0 r/w 2 bufeb 0 r/w 1 cks1 0 r/w clock select 0 1 internal clock: buffer enable b 0 icrd is not used as a buffer register for icrb icrd is used as a buffer register for ocrb 1 buffer enable a 0 icrc is not used as a buffer register for icra icrc is used as a buffer register for ocra 1 input edge select d 0 rising edge of input d is captured falling edge of input d is captured 1 input edge select c 0 rising edge of input c is captured falling edge of input c is captured 1 input edge select b 0 rising edge of input b is captured falling edge of input b is captured 1 input edge select a 0 rising edge of input a is captured falling edge of input a is captured 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 452 of 526 rej09b0326-0600 tocr?timer output compare control register h'f777 timer x bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ocrs 0 r/w 3 oea 0 r/w 0 olvlb 0 r/w 2 oeb 0 r/w 1 olvla 0 r/w output level b 0 low level high level 1 output level a 0 low level high level 1 output enable b 0 output compare b output is disabled output compare b output is enabled 1 output enable a 0 output compare a output is disabled output compare a output is enabled 1 output compare register select 0 ocra is selected ocrb is selected 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 453 of 526 rej09b0326-0600 icrah?input capture register ah h'f778 timer x bit initial value read/write 7 icrah7 0 r 6 icrah6 0 r 5 icrah5 0 r 4 icrah4 0 r 3 icrah3 0 r 0 icrah0 0 r 2 icrah2 0 r 1 icrah1 0 r icral?input capture register al h'f779 timer x bit initial value read/write 7 icral7 0 r 6 icral6 0 r 5 icral5 0 r 4 icral4 0 r 3 icral3 0 r 0 icral0 0 r 2 icral2 0 r 1 icral1 0 r icrbh?input capture register bh h'f77a timer x bit initial value read/write 7 icrbh7 0 r 6 icrbh6 0 r 5 icrbh5 0 r 4 icrbh4 0 r 3 icrbh3 0 r 0 icrbh0 0 r 2 icrbh2 0 r 1 icrbh1 0 r icrbl?input capture register bl h'f77b timer x bit initial value read/write 7 icrbl7 0 r 6 icrbl6 0 r 5 icrbl5 0 r 4 icrbl4 0 r 3 icrbl3 0 r 0 icrbl0 0 r 2 icrbl2 0 r 1 icrbl1 0 r
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 454 of 526 rej09b0326-0600 flmcr?flash memory control register h'ff80 flash memory (flash memory version only) bit initial value read/write 7 v pp 0 r 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ev 0 r/w 0 p 0 r/w 2 pv 0 r/w 1 e 0 r/w programming power 0 12 v is not applied to the fv pp pin 1 12 v is applied to the fv pp pin erase-verify mode 0 exit from erase-verify mode 1 transition to erase-verify mode program-verify mode 0 exit from program-verify mode 1 transition to program-verify mode erase mode 0 exit from erase mode 1 transition to erase mode program mode 0 exit from program mode 1 transition to program mode
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 455 of 526 rej09b0326-0600 ebr1?erase block register 1 h'ff82 flash memory (flash memory version only) bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 lb3 0 r/w 0 lb0 0 r/w 2 lb2 0 r/w 1 lb1 0 r/w large block 3 to 0 0 not selected 1 selected ebr2?erase block register 2 h'ff83 flash memory (flash memory version only) bit initial value read/write 7 sb7 0 r/w 6 sb6 0 r/w 5 sb5 0 r/w 4 sb4 0 r/w 3 sb3 0 r/w 0 sb0 0 r/w 2 sb2 0 r/w 1 sb1 0 r/w small block 7 to 0 0 not selected 1 selected
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 456 of 526 rej09b0326-0600 icrch?input capture register ch h'f77c timer x bit initial value read/write 7 icrch7 0 r 6 icrch6 0 r 5 icrch5 0 r 4 icrch4 0 r 3 icrch3 0 r 0 icrch0 0 r 2 icrch2 0 r 1 icrch1 0 r icrcl?input capture register cl h'f77d timer x bit initial value read/write 7 icrcl7 0 r 6 icrcl6 0 r 5 icrcl5 0 r 4 icrcl4 0 r 3 icrcl3 0 r 0 icrcl0 0 r 2 icrcl2 0 r 1 icrcl1 0 r icrdh?input capture register dh h'f77e timer x bit initial value read/write 7 icrdh7 0 r 6 icrdh6 0 r 5 icrdh5 0 r 4 icrdh4 0 r 3 icrdh3 0 r 0 icrdh0 0 r 2 icrdh2 0 r 1 icrdh1 0 r icrdl?input capture register dl h'f77f timer x bit initial value read/write 7 icrdl7 0 r 6 icrdl6 0 r 5 icrdl5 0 r 4 icrdl4 0 r 3 icrdl3 0 r 0 icrdl0 0 r 2 icrdl2 0 r 1 icrdl1 0 r
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 457 of 526 rej09b0326-0600 scr1?serial control register 1 h'ffa0 sci1 bit initial value read/write 7 snc1 0 r/w 6 snc0 0 r/w 5 mrkon 0 r/w 4 ltch 0 r/w 3 cks3 0 r/w 0 cks0 0 r/w 2 cks2 0 r/w 1 cks1 0 r/w operation mode select clock source select (cks3) 0 clock source is prescaler s, and pin sck is output pin 1 clock source is external clock, and pin sck is input pin latch tail select 0 hold tail is output 1 latch tail is output tail mark control 0 tail mark is not output (synchronous mode) 1 tail mark is output (ssb mode) 0 8-bit synchronous transfer mode 16-bit synchronous transfer mode 1 0 1 0 1 continuous clock output mode reserved clock select (cks2 to cks0) bit 2 cks2 cks1 cks0 bit 1 bit 0 0 ?
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 458 of 526 rej09b0326-0600 scsr1?serial control/status register h'ffa1 sci1 bit initial value read/write 7 ? 1 ? 6 sol 0 r/w 5 orer 0 r/(w) 4 ? 1 ? 3 ? 1 ? 0 stf 0 r/w 2 ? 1 ? 1 mtrf 0 r extended data bit overrun error flag * start flag 0 indicates that transfer is stopped invalid 1 read write read write indicates transfer in progress starts a transfer operation note: only a write of 0 for flag clearing is possible. * 0 [clearing condition] after reading 1, cleared by writing 0 1 [setting condition] set if a clock pulse is input after transfer is complete, when an external clock is used 0so 1 pin output level is low so 1 pin output level changes to low so 1 pin output level is high so 1 pin output level changes to high 1 read write read write tail mark transmit flag 0 idle state and 8- or -16-bit data transfer in progress 1 tail mark transmission in progress
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 459 of 526 rej09b0326-0600 sdru?serial data register u h'ffa2 sci1 bit initial value read/write 7 sdru7 undefined r/w 6 sdru6 undefined r/w 5 sdru5 undefined r/w 4 sdru4 undefined r/w 3 sdru3 undefined r/w 0 sdru0 undefined r/w 2 sdru2 undefined r/w 1 sdru1 undefined r/w stores transmit and receive data 8-bit transfer mode: 16-bit transfer mode: not used upper 8 bits of data sdrl?serial data register l h'ffa3 sci1 bit initial value read/write 7 sdrl7 undefined r/w 6 sdrl6 undefined r/w 5 sdrl5 undefined r/w 4 sdrl4 undefined r/w 3 sdrl3 undefined r/w 0 sdrl0 undefined r/w 2 sdrl2 undefined r/w 1 sdrl1 undefined r/w stores transmit and receive data 8-bit transfer mode: 16-bit transfer mode: 8-bit data lower 8 bits of data
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 460 of 526 rej09b0326-0600 smr?serial mode register h'ffa8 sci3 bit initial value read/write 7 com 0 r/w 6 chr 0 r/w 5 pe 0 r/w 0 cks0 0 r/w 2 mp 0 r/w 1 cks1 0 r/w 4 pm 0 r/w clock select 0 0 1 1 1 multiprocessor mode 0 multiprocessor communication function disabled 1 multiprocessor communication function enabled stop bit length 0 1 stop bit 1 2 stop bits parity mode 0 even parity 1 odd parity parity enable 0 parity bit addition and checking disabled 1 parity bit addition and checking enabled character length 0 8-bit data 1 7-bit data communication mode 0 asynchronous mode 1 synchronous mode 3 stop 0 r/w
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 461 of 526 rej09b0326-0600 brr?bit rate register h'ffa9 sci3 bit initial value read/write 7 brr7 1 r/w 6 brr6 1 r/w 5 brr5 1 r/w 4 brr4 1 r/w 3 brr3 1 r/w 0 brr0 1 r/w 2 brr2 1 r/w 1 brr1 1 r/w
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 462 of 526 rej09b0326-0600 scr3?serial control register 3 h'ffaa sci3 bit initial value read/write 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w 4 re 0 r/w receive interrupt enable 0 receive data full interrupt request (rxi) and receive error interrupt request (eri) disabled 1 receive data full interrupt request (rxi) and receive error interrupt request (eri) enabled multiprocessor interrupt enable 0 multiprocessor interrupt request disabled (normal receive operation) [clearing condition] when data is received in which the multiprocessor bit is set to 1 1 multiprocessor interrupt request enabled the receive interrupt request (rxi), receive error interrupt request (eri), and setting of the rdrf, fer, and oer flags in the serial status register (ssr), are disabled until data with the multiprocessor bit set to 1 is received. transmit enable 0 transmit operation disabled (txd pin is transmit data pin) * 1 1 transmit operation enabled (txd pin is transmit data pin) * 1 receive enable 0 receive operation disabled (rxd pin is i/o port) 1 receive operation enabled (rxd pin is receive data pin) transmit end interrupt enable clock enable 0 bit 1 cke1 0 1 bit 0 cke0 0 1 0 1 communication mode asynchronous synchronous asynchronous synchronous asynchronous synchronous asynchronous synchronous internal clock internal clock internal clock reserved (do not specify this combination) external clock external clock reserved (do not specify this combination) reserved (do not specify this combination) i/o port serial clock output clock output clock input serial clock input clock source sck pin function description transmit end interrupt request (tei) disabled 1 transmit end interrupt request (tei) enabled transmit interrupt enable 0 transmit data empty interrupt request (txi) disabled 1 transmit data empty interrupt request (txi) enabled 3 mpie 0 r/w 3 note: 1. when bit txd is set to 1 in pmr7
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 463 of 526 rej09b0326-0600 tdr?transmit data register h'ffab sci3 bit initial value read/write 7 tdr7 1 r/w 6 tdr6 1 r/w 5 tdr5 1 r/w 4 tdr4 1 r/w 3 tdr3 1 r/w 0 tdr0 1 r/w 2 tdr2 1 r/w 1 tdr1 1 r/w data for transfer to tsr
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 464 of 526 rej09b0326-0600 ssr?serial status register h'ffac sci3 bit initial value read/write note: * only a write of 0 for flag clearing is possible. 7 tdre 1 r/(w) 6 rdrf 0 r/(w) 5 oer 0 r/(w) 0 mpbt 0 r/w 2 tend 1 r 1 mpbr 0 r 4 fer 0 r/(w) receive data register full 0 there is no receive data in rdr [clearing conditions]  after reading rdrf = 1, cleared by writing 0 to rdrf  when rdr data is read by an instruction 1 there is receive data in rdr [setting condition] when reception ends normally and receive data is transferred from rsr to rdr transmit data register empty 0 transmit data written in tdr has not been transferred to tsr [clearing conditions]  after reading tdre = 1, cleared by writing 0 to tdre  when data is written to tdr by an instruction 1 transmit data has not been written to tdr, or transmit data written in tdr has been transferred to tsr [setting conditions]  when bit te in serial control register 3 (scr3) is cleared to 0  when data is transferred from tdr to tsr transmit end 0 transmission in progress [clearing conditions] 1 transmission ended [setting conditions] parity error 0 reception in progress or completed normally [clearing condition] after reading per = 1, cleared by writing 0 to per 1 a parity error has occurred during reception [setting condition] framing error 0 reception in progress or completed normally [clearing condition] after reading fer = 1, cleared by writing 0 to fer 1 a framing error has occurred during reception [setting condition] when the stop bit at the end of the receive data is checked for a value of 1 at completion of reception, and the stop bit is 0 overrun error 0 reception in progress or completed [clearing condition] after reading oer = 1, cleared by writing 0 to oer 1 an overrun error has occurred during reception [setting condition] when the next serial reception is completed with rdrf set to 1 multiprocessor bit receive multiprocessor bit transfer 0 data in which the multiprocessor bit is 0 has been received 1 data in which the multiprocessor bit is 1 has been received 0 a 0 multiprocessor bit is transmitted 1 a 1 multiprocessor bit is transmitted 3 per 0 r/(w) *****  after reading tdre = 1, cleared by writing 0 to tdre  when data is written to tdr by an instruction  when bit te in serial control register 3 (scr3) is cleared to 0  when bit tdre is set to 1 when the last bit of a transmit character is sent when the number of 1 bits in the receive data plus parity bit does not match the parity designated by the parity mode bit (pm) in the serial mode register (smr)
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 465 of 526 rej09b0326-0600 rdr?receive data register h'ffad sci3 bit initial value read/write 7 rdr7 0 r 6 rdr6 0 r 5 rdr5 0 r 4 rdr4 0 r 3 rdr3 0 r 0 rdr0 0 r 2 rdr2 0 r 1 rdr1 0 r tma?timer mode register a h'ffb0 timer a bit initial value read/write 7 tma7 0 r/w 6 tma6 0 r/w 5 tma5 0 r/w 0 tma0 0 r/w 2 tma2 0 r/w 1 tma1 0 r/w internal clock select tma3 tma2 0 pss pss pss pss 0 4 ? 1 ? clock output select 0
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 466 of 526 rej09b0326-0600 tca?timer counter a h'ffb1 timer a bit initial value read/write 7 tca7 0 r 6 tca6 0 r 5 tca5 0 r 4 tca4 0 r 3 tca3 0 r 0 tca0 0 r 2 tca2 0 r 1 tca1 0 r count value tmb1?timer mode register b1 h'ffb2 timer b1 bit initial value read/write 7 tmb17 0 r/w 6 ? 1 ? 5 ? 1 ? 3 ? 1 ? 0 tmb10 0 r/w 2 tmb12 0 r/w 1 tmb11 0 r/w 4 ? 1 ? auto-reload function select clock select 0 internal clock: internal clock: 0 0 1 internal clock: internal clock: 10 1 1 00 1 10 1 internal clock: internal clock: internal clock: external event (tmib):
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 467 of 526 rej09b0326-0600 tcb1?timer counter b1 h'ffb3 timer b1 bit initial value read/write 7 tcb17 0 r 6 tcb16 0 r 5 tcb15 0 r 4 tcb14 0 r 3 tcb13 0 r 0 tcb10 0 r 2 tcb12 0 r 1 tcb11 0 r count value tlb1?timer load register b1 h'ffb3 timer b1 bit initial value read/write 7 tlb17 0 w 6 tlb16 0 w 5 tlb15 0 w 4 tlb14 0 w 3 tlb13 0 w 0 tlb10 0 w 2 tlb12 0 w 1 tlb11 0 w reload value
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 468 of 526 rej09b0326-0600 tcrv0?timer control register v0 h'ffb8 timer v bit initial value read/write 7 cmieb 0 r/w 6 cmiea 0 r/w 5 ovie 0 r/w 4 cclr1 0 r/w 3 cclr0 0 r/w 0 cks0 0 r/w 2 cks2 0 r/w 1 cks1 0 r/w tcrv0 description clock select bit 2 cks2 0 1 clock input disabled internal clock: ? 0 1 0 1 0 1 ? ? ? ? counter clear 1 and 0 00 1 0 1 clearing is disabled cleared by compare match a cleared by compare match b cleared by rising edge of external reset input 1 timer overflow interrupt enable 0 interrupt request (ovi) from ovf disabled interrupt request (ovi) from ovf enabled 1 compare match interrupt enable a 0 interrupt request (cmia) from cmfa disabled interrupt request (cmia) from cmfa enabled 1 compare match interrupt enable b 0 interrupt request (cmib) from cmfb disabled interrupt request (cmib) from cmfb enabled 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 469 of 526 rej09b0326-0600 tcsrv?timer control/status register v h'ffb9 timer v bit initial value read/write 7 cmfb 0 r/(w) 6 cmfa 0 r/(w) 5 ovf 0 r/(w) 4 ? 1 ? 3 os3 0 r/w 0 os0 0 r/w 2 os2 0 r/w 1 os1 0 r/w output select 0 no change at compare match a 0 output at compare match a 1 output at compare match a output toggles at compare match a 1 0 1 0 1 output select 0 no change at compare match b 0 output at compare match b 1 output at compare match b output toggles at compare match b 1 0 1 0 1 timer overflow flag 0 [clearing condition] after reading ovf = 1, cleared by writing 0 to ovf 1 [setting condition] set when tcntv overflows from h'ff to h'00 compare match flag a 0 [clearing condition] after reading cmfa = 1, cleared by writing 0 to cmfa 1 [setting condition] set when the tcntv value matches the tcora value compare match flag b 0 [clearing condition] after reading cmfb = 1, cleared by writing 0 to cmfb 1 [setting condition] set when the tcntv value matches the tcorb value note: * only a write of 0 for flag clearing is possible. ***
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 470 of 526 rej09b0326-0600 tcora?time constant register a h'ffba timer v bit initial value read/write 7 tcora7 1 r/w 6 tcora6 1 r/w 5 tcora5 1 r/w 4 tcora4 1 r/w 3 tcora3 1 r/w 0 tcora0 1 r/w 2 tcora2 1 r/w 1 tcora1 1 r/w tcorb?time constant register b h'ffbb timer v bit initial value read/write 7 tcorb7 1 r/w 6 tcorb6 1 r/w 5 tcorb5 1 r/w 4 tcorb4 1 r/w 3 tcorb3 1 r/w 0 tcorb0 1 r/w 2 tcorb2 1 r/w 1 tcorb1 1 r/w tcntv?timer counter v h'ffbc timer v bit initial value read/write 7 tcntv7 0 r/w 6 tcntv6 0 r/w 5 tcntv5 0 r/w 4 tcntv4 0 r/w 3 tcntv3 0 r/w 0 tcntv0 0 r/w 2 tcntv2 0 r/w 1 tcntv1 0 r/w
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 471 of 526 rej09b0326-0600 tcrv1?timer control register v1 h'ffbd timer v bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 tveg1 0 r/w 3 tveg0 0 r/w 0 icks0 0 r/w 2 trge 0 r/w 1 ? 1 ? trgv input enable 0 tcntv counting is not triggered by input at the trgv pin, and does not stop when tcntv is cleared by compare match 1 tcntv counting is triggered by input at the trgv pin, and stops when tcntv is cleared by compare match internal clock select selects the tcntv clock source, with bits cks2 to cks0 in tcrv0 trgv input edge select 0 trgv trigger input is disabled rising edge is selected falling edge is selected rising and falling edges are both selected 1 0 1 0 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 472 of 526 rej09b0326-0600 tcsrw?timer control/status register w h'ffbe watchdog timer bit initial value read/write 7 b6wi 1 r 6 tcwe 0 r/(w) 5 b4wi 1 r 4 tcsrwe 0 r/(w) 3 b2wi 1 r 0 wrst 0 r/(w) 2 wdon 0 r/(w) 1 b0wi 1 r ** * * watchdog timer reset 0 [clearing conditions] 1 [setting condition] when tcw overflows and a reset signal is generated  reset by res pin  when tcsrwe = 1, and 0 is written in both b0wi and wrst bit 0 write inhibit 0 bit 0 is write-enabled bit 0 is write-protected 1 watchdog timer on 0 watchdog timer operation is disabled watchdog timer operation is enabled 1 bit 2 write inhibit 0 bit 2 is write-enabled bit 2 is write-protected 1 timer control/status register w write enable 0 data cannot be written to tcsrw bits 2 and 0 data can be written to tcsrw bits 2 and 0 1 bit 4 write inhibit 0 bit 4 is write-enabled bit 4 is write-protected 1 timer counter w write enable 0 data cannot be written to tcw data can be written to tcw 1 bit 6 write inhibit 0 bit 6 is write-enabled bit 6 is write-protected 1 note: * write is permitted only under certain conditions.
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 473 of 526 rej09b0326-0600 tcw?timer counter w h'ffbf watchdog timer bit initial value read/write 7 tcw7 0 r/w 6 tcw6 0 r/w 5 tcw5 0 r/w 4 tcw4 0 r/w 3 tcw3 0 r/w 0 tcw0 0 r/w 2 tcw2 0 r/w 1 tcw1 0 r/w count value
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 474 of 526 rej09b0326-0600 amr?a/d mode register h'ffc4 a/d converter bit initial value read/write 7 cks 0 r/w 6 trge 0 r/w 4 ? 1 ? 3 ch3 0 r/w 0 ch0 0 r/w 2 ch2 0 r/w 1 ch1 0 r/w channel select no channel selected bit 3 0 bit 2 analog input channel ch3 ch2 0 ch1 ch0 bit 1 bit 0 0an 1 1 0 1 1 1 00 0 0 1 0 0 1 1 1 external trigger select 0 disables start of a/d conversion by exter al trigger 1 enables start of a/d conversion by rising or falling edge of external trigger at pin adtrg 5 ? 1 ? 4 an 5 an 6 an 7 reserved reserved reserved reserved ** 100 1 10 1 an 0 an 1 an 2 an 3 clock select 62/ ? * conversion time note: * operation is not guaranteed if the conversion time is less than 12.4 s. set bit 7 for a value of at least 12.4 s. * don ? t care
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 475 of 526 rej09b0326-0600 adrr?a/d result register h'ffc5 a/d converter bit initial value read/write 7 adr7 undefined r 6 adr6 undefined r 5 adr5 undefined r 4 adr4 undefined r 3 adr3 undefined r 0 adr0 undefined r 2 adr2 undefined r 1 adr1 undefined r a/d conversion result adsr?a/d start register h'ffc6 a/d converter bit initial value read/write 7 adsf 0 r/w 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? a/d status flag 0 1 read write read write indicates completion of a/d conversion stops a/d conversion indicates a/d conversion in progress starts a/d conversion
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 476 of 526 rej09b0326-0600 pwcr?pwm control register h'ffd0 14-bit pwm bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 pwcr0 0 w 2 ? 1 ? 1 ? 1 ? clock select 0 the input clock is * * note: * t pwdru?pwm data register u h'ffd1 14-bit pwm bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 0 w 4 0 w 3 0 w 0 0 w 2 0 w 1 0 w upper 6 bits of data for generating pwm waveform pwdru5 pwdru4pwdru3 pwdru0 pwdru2 pwdru1 pwdrl?pwm data register l h'ffd2 14-bit pwm bit initial value read/write 7 0 w 6 0 w 5 0 w 4 0 w 3 0 w 0 0 w 2 0 w 1 0 w lower 8 bits of data for generating pwm waveform pwdrl5 pwdrl4 pwdrl3 pwdrl0 pwdrl2 pwdrl1 pwdrl6 pwdrl7
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 477 of 526 rej09b0326-0600 pdr1?port data register 1 h'ffd4 i/o ports bit initial value read/write 7 p1 0 r/w 6 p1 0 r/w 5 p1 0 r/w 4 p1 0 r/w 3 ? 0 ? 0 p1 0 r/w 2 ? 0 ? 1 ? 0 ? 7654 0 pdr2?port data register 2 h'ffd5 i/o ports bit initial value read/write 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 p2 0 r/w 2 p2 0 r/w 1 p2 0 r/w 0 21 pdr3?port data register 3 h'ffd6 i/o ports bit initial value read/write 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 p3 0 r/w 2 p3 0 r/w 1 p3 0 r/w 0 21 pdr5?port data register 5 h'ffd8 i/o ports bit initial value read/write 7 p5 0 r/w 6 p5 0 r/w 5 p5 0 r/w 4 p5 0 r/w 3 p5 0 r/w 0 p5 0 r/w 2 p5 0 r/w 1 p5 0 r/w 30 21 4 5 6 7 pdr6?port data register 6 h'ffd9 i/o ports bit initial value read/write 7 p6 0 r/w 6 p6 0 r/w 5 p6 0 r/w 4 p6 0 r/w 3 p6 0 r/w 0 p6 0 r/w 2 p6 0 r/w 1 p6 0 r/w 30 21 4 5 6 7
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 478 of 526 rej09b0326-0600 pdr7?port data register 7 h'ffda i/o ports bit initial value read/write 7 p7 0 r/w 6 p7 0 r/w 5 p7 0 r/w 4 p7 0 r/w 3 p7 0 r/w 0 ? 0 ? 2 ? 0 ? 1 ? 0 ? 3 4 5 6 7 pdr8?port data register 8 h'ffdb i/o ports bit initial value read/write 7 p8 0 r/w 6 p8 0 r/w 5 p8 0 r/w 4 p8 0 r/w 3 p8 0 r/w 0 p8 0 r/w 2 p8 0 r/w 1 p8 0 r/w 30 21 4 5 6 7 pdr9?port data register 9 h'ffdc i/o ports bit initial value read/write 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 p9 4 0 r/w 3 p9 0 r/w 0 p9 0 0 r/w 2 p9 2 0 r/w 1 p9 1 0 r/w 3 pdrb?port data register b h'ffdd i/o ports bit read/write 7 pb r 6 pb r 5 pb r 4 pb r 3 pb r 0 pb r 2 pb r 1 pb r 30 21 4 5 6 7
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 479 of 526 rej09b0326-0600 pcr1?port control register 1 h'ffe4 i/o ports bit initial value read/write 7 pcr1 0 w 6 pcr1 0 w 5 pcr1 0 w 4 pcr1 0 w 3 ? 0 ? 0 pcr1 0 w 2 ? 0 ? 1 ? 0 ? port 1 input/output select 0 input pin 1 output pin 7654 0 pcr2?port control register 2 h'ffe5 i/o ports bit initial value read/write 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 pcr2 0 w 2 pcr2 0 w 1 pcr2 0 w port 2 input/output select 0 input pin 1 output pin 0 21 pcr3?port control register 3 h'ffe6 i/o ports bit initial value read/write 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 pcr3 0 w 2 pcr3 0 w 1 pcr3 0 w port 3 input/output select 0 input pin 1 output pin 0 21
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 480 of 526 rej09b0326-0600 pcr5?port control register 5 h'ffe8 i/o ports bit initial value read/write 7 pcr5 0 w 6 pcr5 0 w 5 pcr5 0 w 4 pcr5 0 w 3 pcr5 0 w 0 pcr5 0 w 2 pcr5 0 w 1 pcr5 0 w port 5 input/output select 0 input pin 1 output pin 76543 0 21 pcr6?port control register 6 h'ffe9 i/o ports bit initial value read/write 7 pcr6 0 w 6 pcr6 0 w 5 pcr6 0 w 4 pcr6 0 w 3 pcr6 0 w 0 pcr6 0 w 2 pcr6 0 w 1 pcr6 0 w port 6 input/output select 0 input pin 1 output pin 76543 0 21 pcr7?port control register 7 h'ffea i/o ports bit initial value read/write 7 pcr7 0 w 6 pcr7 0 w 5 pcr7 0 w 4 pcr7 0 w 3 pcr7 0 w 0 ? 0 ? 2 ? 0 ? 1 ? 0 ? port 7 input/output select 0 input pin 1 output pin 76543
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 481 of 526 rej09b0326-0600 pcr8?port control register 8 h'ffeb i/o ports bit initial value read/write 7 pcr8 0 w 6 pcr8 0 w 5 pcr8 0 w 4 pcr8 0 w 3 pcr8 0 w 0 pcr8 0 w 2 pcr8 0 w 1 pcr8 0 w port 8 input/output select 0 input pin 1 output pin 76543 0 21 pcr9?port control register 9 h'ffec i/o ports bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 pcr9 0 w 3 pcr9 0 w 0 pcr9 0 w 2 pcr9 0 w 1 pcr9 0 w port 9 input/output select 0 input pin 1 output pin 0 2 3 41 pucr1?port pull-up control register 1 h'ffed i/o ports bit initial value read/write 7 pucr1 0 r/w 6 pucr1 0 r/w 5 pucr1 0 r/w 4 pucr1 0 r/w 3 ? 0 ? 0 pucr1 0 r/w 2 ? 0 ? 1 ? 0 ? 0 4 5 6 7 pucr3?port pull-up control register 3 h'ffee i/o ports bit initial value read/write 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 pucr3 0 r/w 2 pucr3 0 r/w 1 pucr3 0 r/w 0 21
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 482 of 526 rej09b0326-0600 pucr5?port pull-up control register 5 h'ffef i/o ports bit initial value read/write 7 pucr5 0 r/w 6 pucr5 0 r/w 5 pucr5 0 r/w 4 pucr5 0 r/w 3 pucr5 0 r/w 0 pucr5 0 r/w 2 pucr5 0 r/w 1 pucr5 0 r/w 30 21 4 5 6 7 syscr1?system control register 1 h'fff0 system control bit initial value read/write 7 ssby 0 r/w 6 sts2 0 r/w 5 sts1 0 r/w 3 lson 0 r/w 0 ma0 1 r/w 2 ? 1 ? 1 ma1 1 r/w 4 sts0 0 r/w software standby 0  when a sleep instruction is executed in active mode, a transition is made to sleep mode 1 standby timer select 2 to 0 0 wait time = 8,192 states wait time = 16,384 states 0 0 1 wait time = 32,768 states wait time = 65,536 states 10 1 active (medium-speed) mode clock select * wait time = 131,072 states low speed on flag 0 the cpu operates on the system clock ( *  when a sleep instruction is executed in subactive mode, a transition is made to subsleep mode  when a sleep instruction is executed in active mode, a transition is made to standby mode or watch mode  when a sleep instruction is executed in subactive mode, a transition is made to watch mode don ? t care * osc osc osc osc
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 483 of 526 rej09b0326-0600 syscr2?system control register 2 h'fff1 system control bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 3 dton 0 r/w 0 sa0 0 r/w 2 mson 0 r/w 1 sa1 0 r/w 4 nesel 0 r/w subactive mode clock select 0 * w w w direct transfer on flag 0  when a sleep instruction is executed in active mode, a transition is made to standby mode, watch mode, or sleep mode 1  when a sleep instruction is executed in subactive mode, a transition is made to watch mode or subsleep mode  when a sleep instruction is executed in active (high-speed) mode, a direct transition is made to active (medium-speed) mode if ssby = 0, mson = 1, and lson = 0, or to subactive mode if ssby = 1, tma3 = 1, and lson = 1  when a sleep instruction is executed in active (medium-speed) mode, a direct transition is made to active (high-speed) mode if ssby = 0, mson = 0, and lson = 0, or to subactive mode if ssby = 1, tma3 = 1, and lson = 1  when a sleep instruction is executed in subactive mode, a direct transition is made to active (high-speed) mode if ssby = 1, tma3 = 1, lson = 0, and mson = 0, or to active (medium-speed) mode if ssby = 1, tma3 = 1, lson = 0, and mson = 1 medium speed on flag 0  operates in active (high-speed) mode after exit from standby, watch, or sleep mode  operates in sleep (high-speed) mode if a sleep instruction is executed in active mode 1  operates in active (medium-speed) mode after exit from standby, watch, or sleep mode  operates in sleep (medium-speed) mode if a sleep instruction is executed in active mode noise elimination sampling frequency select 0 sampling rate is ? t care *
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 484 of 526 rej09b0326-0600 iegr1?interrupt edge select register 1 h'fff2 system control bit initial value read/write 7 ? 0 ? 6 ? 1 ? 4 ? 1 ? 3 ieg3 0 r/w 0 ieg0 0 r/w 2 ieg2 0 r/w 1 ieg1 0 r/w 5 ? 1 ? irq 0 edge select 0 falling edge of irq 0 pin input is detected rising edge of irq 0 pin input is detected 1 irq 1 edge select 0 falling edge of irq 1 pin input is detected rising edge of irq 1 pin input is detected 1 irq 2 edge select 0 falling edge of irq 2 pin input is detected rising edge of irq 2 pin input is detected 1 irq 3 edge select 0 falling edge of irq 3 pin input is detected rising edge of irq 3 pin input is detected 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 485 of 526 rej09b0326-0600 iegr2?interrupt edge select register 2 h'fff3 system control bit initial value read/write 7 integ7 0 r/w 6 integ6 0 r/w 4 integ4 0 r/w 3 integ3 0 r/w 0 integ0 0 r/w 2 integ2 0 r/w 1 integ1 0 r/w 5 integ5 0 r/w int 4 to int 0 edge select 0 falling edge of int n pin input is detected rising edge of int n pin input is detected 1 int 6 edge select 0 falling edge of int 6 and tmib pin input is detected rising edge of int 6 and tmib pin input is detected 1 int 5 edge select 0 falling edge of int 5 and adtrg pin input is detected rising edge of int 5 and adtrg pin input is detected 1 int 7 edge select 0 falling edge of int 7 pin input is detected rising edge of int 7 pin input is detected 1 (n = 4 to 0)
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 486 of 526 rej09b0326-0600 ienr1?interrupt enable register 1 h'fff4 system control bit initial value read/write 7 ientb1 0 r/w 6 ienta 0 r/w 4 ? 1 ? 3 ien3 0 r/w 0 ien0 0 r/w 2 ien2 0 r/w 1 ien1 0 r/w 5 ? 0 ? irq 3 to irq 0 interrupt enable 0 disables irq3 to irq 0 interrupt requests enables irq3 to irq 0 interrupt requests 1 timer a interrupt enable 0 disables timer a interrupt requests enables timer a interrupt requests 1 timer b1 interrupt enable 0 disables timer b1 interrupt requests enables timer b1 interrupt requests 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 487 of 526 rej09b0326-0600 ienr2?interrupt enable register 2 h'fff5 system control bit initial value read/write 7 iendt 0 r/w 6 ienad 0 r/w 4 iens1 0 r/w 3 ? 0 ? 0 ? 0 ? 2 ? 0 ? 1 ? 0 ? 5 ? 0 ? sci1 interrupt enable 0 disables sci1 interrupt requests enables sci1 interrupt requests 1 a/d converter interrupt enable 0 disables a/d converter interrupt requests enables a/d converter interrupt requests 1 direct transfer interrupt enable 0 disables direct transfer interrupt requests enables direct transfer interrupt requests 1 ienr3?interrupt enable register 3 h'fff6 system control bit initial value read/write 7 inten7 0 r/w 6 inten6 0 r/w 5 inten5 0 r/w 4 inten4 0 r/w 3 inten3 0 r/w 0 inten0 0 r/w 2 inten2 0 r/w 1 inten1 0 r/w int 7 to int 0 interrupt enable 0 disables int 7 to int 0 interrupt requests enables int 7 to int 0 interrupt requests 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 488 of 526 rej09b0326-0600 irr1?interrupt request register 1 h'fff7 system control bit initial value read/write 7 irrtb1 0 r/w 6 irrta 0 r/w 4 ? 1 ? 3 irri3 0 r/w 0 irri0 0 r/w 2 irri2 0 r/w 1 irri1 0 r/w 5 ? 0 ? ** ** * * irq 3 to irq 0 interrupt request flag 0 [clearing condition] 1 [setting condition] when irrin = 1, it is cleared by writing 0 when pin irqn is set for interrupt input and the designated signal edge is input timer a interrupt request flag 0 [clearing condition] 1 [setting condition] when irrta = 1, it is cleared by writing 0 when timer counter a overflows from h'ff to h'00 timer b1 interrupt request flag 0 [clearing condition] 1 [setting condition] when irrtb1 = 1, it is cleared by writing 0 when timer counter b1 overflows from h'ff to h'00 note: * only a write of 0 for flag clearing is possible. (n = 3 to 0)
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 489 of 526 rej09b0326-0600 irr2?interrupt request register 2 h'fff8 system control bit initial value read/write 7 irrdt 0 r/w 6 irrad 0 r/w 5 ? 0 ? 4 irrs1 0 r/w 3 ? 0 ? 0 ? 0 ? 2 ? 0 ? 1 ? 0 ? ** * 0 [clearing condition] when irrs1 = 1, it is cleared by writing 0 sci1 interrupt request flag 1 [setting condition] when an sci1 transfer is completed 0 [clearing condition] when irrad = 1, it is cleared by writing 0 a/d converter interrupt request flag 1 [setting condition] when a/d conversion is completed and adsf is cleared to 0 in adsr 0 [clearing condition] when irrdt = 1, it is cleared by writing 0 direct transfer interrupt request flag 1 [setting condition] a sleep instruction is executed when dton = 1 and a direct transfer is made note: * only a write of 0 for flag clearing is possible.
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 490 of 526 rej09b0326-0600 irr3?interrupt request register 3 h'fff9 system control bit initial value read/write 7 intf7 0 r/w 6 intf6 0 r/w 5 intf5 0 r/w 4 intf4 0 r/w 3 intf3 0 r/w 0 intf0 0 r/w 2 intf2 0 r/w 1 intf1 0 r/w int 7 to int 0 interrupt request flag 0 [clearing condition] when intf n = 1, it is cleared by writing 0 1 [setting condition] when the designated signal edge is input at pin int n note: * only a write of 0 for flag clearing is possible. *** ** ** (n = 7 to 0)
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 491 of 526 rej09b0326-0600 pmr1?port mode register 1 h'fffc i/o ports bit initial value read/write 7 irq3 0 r/w 6 irq2 0 r/w 4 pwm 0 r/w 3 ? 0 ? 0 tmow 0 r/w 2 ? 1 ? 1 ? 0 ? 5 irq1 0 r/w p1 0 /tmow pin function switch 0 functions as p1 0 i/o pin functions as tmow output pin 1 p1 4 /pwm pin function switch 0 functions as p1 4 i/o pin functions as pwm output pin 1 p1 5 /irq 1 pin function switch 0 functions as p1 5 i/o pin functions as irq 1 input pin 1 p1 6 /irq 2 pin function switch 0 functions as p1 6 i/o pin functions as irq 2 input pin 1 p1 7 /irq 3 pin function switch 0 functions as p1 7 i/o pin functions as irq 3 /trgv input pin 1
appendix b internal i/o registers rev. 6.00 sep 12, 2006 page 492 of 526 rej09b0326-0600 pmr3?port mode register 3 h'fffd i/o ports bit initial value read/write 7 ? 0 ? 6 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 sck1 0 r/w 2 so1 0 r/w 1 si1 0 r/w 5 ? 0 ? p3 0 /sck 1 pin function switch 0 functions as p3 0 i/o pin functions as sck 1 i/o pin 1 p3 2 /so 1 pin function switch 0 functions as p3 2 i/o pin functions as so 1 output pin 1 p3 1 /si 1 pin function switch 0 functions as p3 1 i/o pin functions as si 1 input pin 1 pmr7?port mode register 7 h'ffff i/o ports bit initial value read/write 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 ? 1 ? 0 pof1 0 r/w 2 txd 0 r/w 1 ? 0 ? p3 2 /so 1 pin pmos control 0 cmos output nmos open-drain output 1 p2 2 /txd pin function switch (txd) 0 functions as p2 2 i/o pin functions as txd output pin 1
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 493 of 526 rej09b0326-0600 appendix c i/o port block diagrams c.1 block diagrams of port 1 v cc v cc v ss pucr1 n pmr1 n pdr1 n pcr1 n irq n?4 res sby (low level during reset and in standby mode) internal data bus legend: pdr1: pcr1: pmr1: pucr1: note: n = 7 or 6 port data register 1 port control register 1 port mode register 1 port pull-up control register 1 p1 n figure c.1 (a) port 1 block diagram (pins p1 7 and p1 6 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 494 of 526 rej09b0326-0600 v cc v cc v ss pucr1 5 pmr1 5 pdr1 5 pcr1 5 irq 1 res sby (low level during reset and in standby mode) internal data bus legend: pdr1: pcr1: pmr1: pucr1: port data register 1 port control register 1 port mode register 1 port pull-up control register 1 p1 5 figure c.1 (b) port 1 block diagram (pin p1 5 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 495 of 526 rej09b0326-0600 v cc v cc v ss pucr1 4 pmr1 4 pdr1 4 pcr1 4 res sby (low level during reset and in standby mode) internal data bus legend: pdr1: pcr1: pmr1: pucr1: port data register 1 port control register 1 port mode register 1 port pull-up control register 1 pwm pwm module p1 4 figure c.1 (c) port 1 block diagram (pin p1 4 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 496 of 526 rej09b0326-0600 v cc v cc v ss pucr1 0 pmr1 0 pdr1 0 pcr1 0 res sby internal data bus legend: pdr1: pcr1: pmr1: pucr1: port data register 1 port control register 1 port mode register 1 port pull-up control register 1 tmow timer a module p1 0 (low level during reset and in standby mode) figure c.1 (d) port 1 block diagram (pin p1 0 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 497 of 526 rej09b0326-0600 c.2 block diagrams of port 2 v cc v ss pmr7 2 pcr2 2 pdr2 2 sby internal data bus legend: pdr2: pcr2: pmr7: port data register 2 port control register 2 port mode register 7 txd sci3 module p2 2 figure c.2 (a) port 2 block diagram (pin p2 2 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 498 of 526 rej09b0326-0600 v cc v ss pcr2 1 pdr2 1 sby internal data bus legend: pdr2: pcr2: port data register 2 port control register 2 re rxd sci3 module p2 1 figure c.2 (b) port 2 block diagram (pin p2 1 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 499 of 526 rej09b0326-0600 v cc v ss pcr2 0 pdr2 0 sby internal data bus legend: pdr2: pcr2: port data register 2 port control register 2 sckie sckoe scko scki sci3 module p2 0 figure c.2 (c) port 2 block diagram (pin p2 0 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 500 of 526 rej09b0326-0600 c.3 block diagrams of port 3 v cc v cc v ss pucr3 2 pmr3 2 pdr3 2 pcr3 2 res sby (low level during reset and in standby mode) internal data bus legend: pdr3: pcr3: pmr3: pmr7: pucr3: port data register 3 port control register 3 port mode register 3 port mode register 7 port pull-up control register 3 so1 sci1 module p3 2 pmr7 0 figure c.3 (a) port 3 block diagram (pin p3 2 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 501 of 526 rej09b0326-0600 v cc v cc v ss pucr3 1 pdr3 1 pcr3 1 si1 res sby internal data bus legend: pdr3: pcr3: pmr3: pucr3: port data register 3 port control register 3 port mode register 3 port pull-up control register 3 p3 1 (low level during reset and in standby mode) sci1 module pmr3 1 figure c.3 (b) port 3 block diagram (pin p3 1 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 502 of 526 rej09b0326-0600 v cc v cc v ss pucr3 0 pmr3 0 pdr3 0 pcr3 0 res sby legend: pdr3: pcr3: pmr3: pucr3: port data register 3 port control register 3 port mode register 3 port pull-up control register 3 sci1 module p3 0 (low level during reset and in standby mode) cks3 sck1 internal data bus sck0 figure c.3 (c) port 3 block diagram (pin p3 0 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 503 of 526 rej09b0326-0600 c.4 block diagrams of port 5 v cc v cc v ss int n res sby internal data bus legend: pdr5: pcr5: pucr5: note: n = 7, 4 to 0 port data register 5 port control register 5 port pull-up control register 5 p5 n (low level during reset and in standby mode) int module pucr5 n pdr5 n pcr5 n figure c.4 (a) port 5 block diagram (pins p5 7 and p5 4 to p5 0 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 504 of 526 rej09b0326-0600 v cc v cc v ss int 6 sby internal data bus legend: pdr5: pcr5: pucr5: port data register 5 port control register 5 port pull-up control register 5 p5 6 (low level during reset and in standby mode) int module pucr5 6 pdr5 6 pcr5 6 tmib timer b1 module figure c.4 (b) port 5 block diagram (pin p5 6 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 505 of 526 rej09b0326-0600 v cc v cc v ss int 5 res sby internal data bus legend: pdr5: pcr5: pucr5: port data register 5 port control register 5 port pull-up control register 5 p5 5 (low level during reset and in standby mode) int module pucr5 5 pdr5 5 pcr5 5 adtrg a/d module figure c.4 (c) port 5 block diagram (pin p5 5 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 506 of 526 rej09b0326-0600 c.5 block diagram of port 6 v cc v ss pcr6 n pdr6 n sby internal data bus legend: pdr6: pcr6: note: n = 7 to 0 port data register 6 port control register 6 p6 n (low level during reset and in standby mode) figure c.5 port 6 block diagram (pins p6 7 to p6 0 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 507 of 526 rej09b0326-0600 c.6 block diagrams of port 7 v cc v ss sby internal data bus legend: pdr7: pcr7: note: n = 7 or 3 port data register 7 port control register 7 p7 n (low level during reset and in standby mode) pdr7 n pcr7 n figure c.6 (a) port 7 block diagram (pins p7 7 and p7 3 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 508 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr7: pcr7: port data register 7 port control register 7 p7 6 (low level during reset and in standby mode) pdr7 6 pcr7 6 0s3 to 0s0 tmov timer v module figure c.6 (b) port 7 block diagram (pin p7 6 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 509 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr7: pcr7: port data register 7 port control register 7 p7 5 (low level during reset and in standby mode) pdr7 5 pcr7 5 tmciv timer v module figure c.6 (c) port 7 block diagram (pin p7 5 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 510 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr7: pcr7: port data register 7 port control register 7 p7 4 (low level during reset and in standby mode) pdr7 4 pcr7 4 tmriv timer v module figure c.6 (d) port 7 block diagram (pin p7 4 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 511 of 526 rej09b0326-0600 c.7 block diagrams of port 8 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 7 (low level during reset and in standby mode) pdr8 7 pcr8 7 figure c.7 (a) port 8 block diagram (pin p8 7 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 512 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 6 (low level during reset and in standby mode) pdr8 6 pcr8 6 ftid timer x module figure c.7 (b) port 8 block diagram (pin p8 6 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 513 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 5 (low level during reset and in standby mode) pdr8 5 pcr8 5 ftic timer x module figure c.7 (c) port 8 block diagram (pin p8 5 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 514 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 4 (low level during reset and in standby mode) pdr8 4 pcr8 4 ftib timer x module figure c.7 (d) port 8 block diagram (pin p8 4 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 515 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 3 (low level during reset and in standby mode) pdr8 3 pcr8 3 ftia timer x module figure c.7 (e) port 8 block diagram (pin p8 3 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 516 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 2 (low level during reset and in standby mode) pdr8 2 pcr8 2 oeb ftob timer x module figure c.7 (f) port 8 block diagram (pin p8 2 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 517 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 1 (low level during reset and in standby mode) pdr8 1 pcr8 1 oea ftoa timer x module figure c.7 (g) port 8 block diagram (pin p8 1 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 518 of 526 rej09b0326-0600 v cc v ss sby internal data bus legend: pdr8: pcr8: port data register 8 port control register 8 p8 0 (low level during reset and in standby mode) pdr8 0 pcr8 0 ftci timer x module p8 0 figure c.7 (h) port 8 block diagram (pin p8 0 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 519 of 526 rej09b0326-0600 c.8 block diagram of port 9 pdr9 n pcr9 n sby internal data bus legend: pdr9: pcr9: note: n = 4 to 0 port data register 9 port control register 9 p9 n (low level during reset and in standby mode) v cc v ss figure c.8 port 9 block diagram (pins p9 4 to p9 0 )
appendix c i/o port block diagrams rev. 6.00 sep 12, 2006 page 520 of 526 rej09b0326-0600 c.9 block diagram of port b pb n internal data bus amr3 to amr0 a/d module v in note: n = 7 to 0 dec figure c.9 port b block diagram (pins pb 7 to pb 0 )
appendix d port states in the different processing states rev. 6.00 sep 12, 2006 page 521 of 526 rej09b0326-0600 appendix d port states in the different processing states table d.1 port states overview port reset sleep subsleep standby watch subactive active p1 7 to p1 4 , p1 0 high impedance retained retained high impedance * retained functions functions p2 2 to p2 0 high impedance retained retained high impedance retained functions functions p3 2 to p3 0 high impedance retained retained high impedance * retained functions functions p5 7 to p5 0 high impedance retained retained high impedance * retained functions functions p6 7 to p6 0 high impedance retained retained high impedance retained functions functions p7 7 to p7 3 high impedance retained retained high impedance retained functions functions p8 7 to p8 0 high impedance retained retained high impedance retained functions functions p9 4 to p9 0 high impedance retained retained high impedance retained functions functions pb 7 to pb 0 high impedance high impedance high impedance high impedance high impedance high impedance high impedance note: * high level output when mos pull-up is in on state.
appendix e product code lineup rev. 6.00 sep 12, 2006 page 522 of 526 rej09b0326-0600 appendix e product code lineup table e.1 product lineup product type product code mark code package (package code) h8/3644 ztat tm version standard products hd6473644h hd6473644rh hd6473644h 64-pin qfp (fp-64a) hd6473644p hd6473644rp hd6473644p 64-pin sdip (dp-64s) hd6473644w hd6473644rw hd6473644w 80-pin tqfp (tfp-80c) flash hd64f3644h hd64f3644h 64-pin qfp (fp-64a) hd64f3644p hd64f3644p 64-pin sdip (dp-64s) hd64f3644w hd64f3644w 80-pin tqfp (tfp-80c) mask rom version hd6433644h hd6433644rh hd6433644( *** )h 64-pin qfp (fp-64a) hd6433644p hd6433644rp hd6433644( *** )p 64-pin sdip (dp-64s) hd6433644w hd6433644rw hd6433644( *** )w 80-pin tqfp (tfp-80c) h8/3643 flash standard HD64F3643h HD64F3643h 64-pin qfp (fp-64a) products HD64F3643p HD64F3643p 64-pin sdip (dp-64s) HD64F3643w HD64F3643w 80-pin tqfp (tfp-80c) mask rom version hd6433643h hd6433643rh hd6433643( *** )h 64-pin qfp (fp-64a) hd6433643p hd6433643rp hd6433643( *** )p 64-pin sdip (dp-64s) hd6433643w hd6433643rw hd6433643( *** )w 80-pin tqfp (tfp-80c)
appendix e product code lineup rev. 6.00 sep 12, 2006 page 523 of 526 rej09b0326-0600 product type product code mark code package (package code) h8/3642 flash standard hd64f3642ah hd64f3642ah 64-pin qfp (fp-64a) products hd64f3642ap hd64f3642ap 64-pin sdip (dp-64s) hd64f3642aw hd64f3642aw 80-pin tqfp (tfp-80c) mask rom version hd6433642h hd6433642rh hd6433642( *** )h 64-pin qfp (fp-64a) hd6433642p hd6433642rp hd6433642( *** )p 64-pin sdip (dp-64s) hd6433642w hd6433642rw hd6433642( *** )w 80-pin tqfp (tfp-80c) h8/3641 mask rom version standard products hd6433641h hd6433641rh hd6433641( *** )h 64-pin qfp (fp-64a) hd6433641p hd6433641rp hd6433641( *** )p 64-pin sdip (dp-64s) hd6433641w hd6433641rw hd6433641( *** )w 80-pin tqfp (tfp-80c) h8/3640 mask rom version standard products hd6433640h hd6433640rh hd6433640( *** )h 64-pin qfp (fp-64a) hd6433640p hd6433640rp hd6433640( *** )p 64-pin sdip (dp-64s) hd6433640w hd6433640rw hd6433640( *** )w 80-pin tqfp (tfp-80c) note: for mask rom versions, ( *** ) is the rom code.
appendix f package dimensions rev. 6.00 sep 12, 2006 page 524 of 526 rej09b0326-0600 appendix f package dimensions the package dimension that is shown in the package data book has priority. note) 1. dimensions"*1"and"*2" do not include mold flash 2. dimension"*3"does not include trim offset. * 1 * 2 * 3 p e d e d xm y f 64 1 17 16 49 48 32 33 z z d h e h b 2 1 1 detail f c a a l a l terminal cross section p 1 1 c b c b 0.8 1.0 1.0 0.15 0.10 8? 0? 0.25 0.10 0.15 0.35 0.00 0.45 0.37 0.29 0.22 0.17 0.12 3.05 16.9 17.2 17.5 d l 1 z e z d y x c b 1 b p a h d a 2 e a 1 c 1 e e l h e 1.1 0.8 0.5 max nom min dimension in millimeters symbol reference 14 2.70 17.5 17.2 16.9 1.6 14 p-qfp64-14x14-0.80 1.2g mass[typ.] fp-64a/fp-64av prqp0064gb-a renesas code jeita package code previous code figure f.1 fp-64a package dimensions
appendix f package dimensions rev. 6.00 sep 12, 2006 page 525 of 526 rej09b0326-0600 1 p 1 3 1 32 64 33 c e z a b b e d e l a 2.54 1.46 0.48 0.38 18.6 58.5 15 ? 0 ? 2.03 1.78 1.53 0.36 0.25 0.20 1.0 0.58 0.51 e 1 l e c b p a e d b 3 z a 1 5.08 17.0 57.6 reference symbol dimension in millimeters min nom max 19.05 p-sdip64-17x57.6-1.78 8.8g mass[typ.] dp-64s/dp-64sv prdp0064bb-a renesas code jeita package code previous code figure f.2 dp-64s package dimensions
appendix f package dimensions rev. 6.00 sep 12, 2006 page 526 of 526 rej09b0326-0600 note) 1. dimensions" * 1"and" * 2" do not include mold flash 2. dimension" * 3"does not include trim offset. 12 0.6 0.5 0.4 max nom min dimension in millimeters symbol reference 12 1.00 14.2 14.0 13.8 1.0 h 1 l e e c 1 a 1 e a 2 h d a b p b 1 c x y z d z e l 1 d 13.8 14.0 14.2 1.20 0.00 0.10 0.20 0.17 0.22 0.27 0.20 0.12 0.17 0.22 0.15 0 ? 8 ? 0.5 0.10 0.10 1.25 1.25 index mark * 1 * 2 * 3 y f 80 1 m x 20 21 61 60 41 40 d e d e p b h e h d z z detail f 1 12 c l a a a l 1 1 p terminal cross section b c c b p-tqfp80-12x12-0.50 0.4g mass[typ.] tfp-80c/tfp-80cv ptqp0080kc-a renesas code jeita package code previous code figure f.3 tfp-80c package dimensions note: in case of inconsistencies arising within figures, dimensional drawings listed in the package data book take precedence and are considered correct.
renesas 8-bit single-chip microcomputer hardware manual h8/3644 group, h8/3644r group, h8/3644 f-ztat?, h8/3643 f-ztat?, h8/3642a f-ztat? publication date: 1st edition, september 1999 rev.6.00, september 12, 2006 published by: sales strategic planning div. renesas technology corp. edited by: customer support department global strategic communication div. renesas solutions corp. ?2006. renesas technology corp., all rights reserved. printed in japan.
sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to " http://www.renesas.com/en/network " for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, u.k. tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology (shanghai) co., ltd. unit 204, 205, aziacenter, no.1233 lujiazui ring rd, pudong district, shanghai, china 200120 tel: <86> (21) 5877-1818, fax: <86> (21) 6887-7898 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, 1 canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2730-6071 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 2713-2999 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas technology korea co., ltd. kukje center bldg. 18th fl., 191, 2-ka, hangang-ro, yongsan-ku, seoul 140-702, korea tel: <82> (2) 796-3115, fax: <82> (2) 796-2145 renesas technology malaysia sdn. bhd unit 906, block b, menara amcorp, amcorp trade centre, no.18, jalan persiaran barat, 46050 petaling jaya, selangor darul ehsan, malaysia tel: <603> 7955-9390, fax: <603> 7955-9510 renesas sales offices colophon 6.0
h8/3644 group, h8/3644r group h8/3644 f-ztat tm , h8/3643 f-ztat tm , h8/3642a f-ztat tm rej09b0326-0600 users manual 1753, shimonumabe, nakahara-ku, kawasaki-shi, kanagawa 211-8668 japan


▲Up To Search▲   

 
Price & Availability of HD64F3643

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X